Giter Site home page Giter Site logo

Comments (3)

begelundmuller avatar begelundmuller commented on July 24, 2024

I agree that b is too weird. Another alternative (let's call it d) would be to input the bound arguments only to the last statement. I wonder what the other DuckDB binding libraries (e.g. Python or Node) do?

Intuitively, I think a would make the most sense – I took a look, and I think we can use duckdb_nparams to distribute the args correctly over the statements as they're prepared and executed.

If there are multiple SELECT statements in one query string (which I would never do), I would expect to get the result of only the last SELECT statement (but the error of the first that failed, if any).

Generally though, I don't have much of a use case for doing multiple statements with bound args. The main use cases I can think of for multi-statement queries are when loading queries from a file (e.g. migrations) or receiving them from the user – in both cases, bound args are unlikely to be used. So c should also be fine.

from go-duckdb.

marcboeker avatar marcboeker commented on July 24, 2024

Thanks for your detailed opinion. I agree with you, that having multiple SELECTs in one statement is kinda weird.

It seems, that the Python driver applies the given parameters to each query instead of distributing them.
The C++ API seems to have the identical behavior. This is similar to b.

And the Python driver also returns the result of the last statement.

I think I need to do more research on this to prevent total confusion.

from go-duckdb.

begelundmuller avatar begelundmuller commented on July 24, 2024

If that's what the official drivers do, I would probably just do the same for Go :)

from go-duckdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.