Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce executemultiple for returning multiple resultsets from #26

Merged
merged 1 commit into from
May 4, 2020

Conversation

quinnj
Copy link
Member

@quinnj quinnj commented May 3, 2020

single query

Lots of databases (and even the ODBC spec) support returning multiple
resultsets from a single query execution call (usually the individual
sql queries must be separated by semi-colons, but stored procedures can
also return multiple resultsets). This formalizes the idea by
introducing DBInterface.executemultiple, which looks and acts exactly
like DBInterface.execute (takes conn arg, query string, params,
etc.), except instead of returning a single Cursor, it returns an
iterator of Cursors. I like that this doesn't affect/change execute
at all, and is strictly additive in functionality for the interface
overall.

single query

Lots of databases (and even the ODBC spec) support returning multiple
resultsets from a single query execution call (usually the individual
sql queries must be separated by semi-colons, but stored procedures can
also return multiple resultsets). This formalizes the idea by
introducing `DBInterface.executemultiple`, which looks and acts exactly
like `DBInterface.execute` (takes `conn` arg, query string, params,
etc.), except instead of returning a single `Cursor`, it returns an
iterator of `Cursor`s. I like that this doesn't affect/change `execute`
at all, and is strictly additive in functionality for the interface
overall.
quinnj added a commit to JuliaDatabases/MySQL.jl that referenced this pull request May 3, 2020
This allows returning multiple resultsets from a single query call; this
requires setting `multi_statements` to `true` by default, but I couldn't
think of any downside to doing this (vs. the alternative in which a user
finds the function, tries it and immediately fails and has to restart
their connection by setting the flag). Prepared statements don't support
multiple resultsets, and an error is thrown appropriately (from mysql
itself). This PR requires
JuliaDatabases/DBInterface.jl#26 to be merged
and tagged first.
@quinnj quinnj merged commit b3c2a44 into master May 4, 2020
@quinnj quinnj deleted the jq/executemultiple branch May 4, 2020 15:28
quinnj added a commit to JuliaDatabases/MySQL.jl that referenced this pull request May 5, 2020
This allows returning multiple resultsets from a single query call; this
requires setting `multi_statements` to `true` by default, but I couldn't
think of any downside to doing this (vs. the alternative in which a user
finds the function, tries it and immediately fails and has to restart
their connection by setting the flag). Prepared statements don't support
multiple resultsets, and an error is thrown appropriately (from mysql
itself). This PR requires
JuliaDatabases/DBInterface.jl#26 to be merged
and tagged first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant