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

Multi-Results Support #420

Closed
julienschmidt opened this issue Feb 5, 2016 · 5 comments
Closed

Multi-Results Support #420

julienschmidt opened this issue Feb 5, 2016 · 5 comments
Milestone

Comments

@julienschmidt
Copy link
Member

Currently the driver returns the first result if there is more than one.
Would it make more sense to return the last result instead?

CREATE TABLE example (num INT); INSERT INTO example VALUES (1), (23), (42); UPDATE example SET num = num+10 WHERE num < 25

I assume that usually the last statement is the one you care about. Any thoughts?

@julienschmidt julienschmidt added this to the v1.3 milestone Feb 5, 2016
@PuppyKhan
Copy link

Not necessarily. With stored procedures, the last result is not the last query, but an additional acknowledgement afterwards.

@arnehormann
Copy link
Member

It's simpler to move the query you are interested in to the last position. I have some SET @VAR := ... queries that prepare a session context for a SELECT and I'd primarily use the multi result feature for these. It's pretty hard to rewrite these queries with SELECT as the first statement.

I'm all for the last one. But formed slightly different: always return the last result matching the call type; counts for Exec, rows for Query.

I have add I'm not sure yet if it's possible to differentiate between Exec and Query with an emptyRows result.

@julienschmidt julienschmidt changed the title Multi-Results: Which result to return? Multi-Results Support Oct 24, 2016
@julienschmidt
Copy link
Member Author

Looks like we can have proper Multi-Results Support in Go 1.8: golang/go@86b2f29

@bkubiak
Copy link

bkubiak commented Dec 1, 2016

+1 for this long-awaited feature, we are using sets of prepared stored procedures that return multiple results.

@julienschmidt
Copy link
Member Author

v1.3 has just been tagged and the master branch is open to potentially less stable changes again. I'd be very glad to accept a pull request on this!

If someone (including a new face) wants to work on this, please let us know!

jszwec added a commit to jszwec/mysql that referenced this issue Jan 9, 2017
jszwec added a commit to jszwec/mysql that referenced this issue Jan 9, 2017
jszwec added a commit to jszwec/mysql that referenced this issue Jan 9, 2017
jszwec added a commit to jszwec/mysql that referenced this issue Jan 10, 2017
jszwec added a commit to jszwec/mysql that referenced this issue Jan 10, 2017
jszwec added a commit to jszwec/mysql that referenced this issue Jan 10, 2017
jszwec added a commit to jszwec/mysql that referenced this issue Jan 10, 2017
jszwec added a commit to jszwec/mysql that referenced this issue Jan 10, 2017
jszwec added a commit to jszwec/mysql that referenced this issue Jan 10, 2017
akihikodaki added a commit to kagucho/tsubonesystem3 that referenced this issue Jan 19, 2017
laolvzh added a commit to laolvzh/mysql that referenced this issue Feb 23, 2017
commit 0e119f8
Author: jszwec <[email protected]>
Date:   Sun Jan 15 13:41:56 2017 -0500

    Multi-Results: review suggestion

    - get rid of a recursive call

commit 8b062e7
Author: jszwec <[email protected]>
Date:   Sun Jan 15 11:50:06 2017 -0500

    Multi-Results: fix hanging rows.Close()

    * rows.Close() would hang on readUntilEOF if some results were ignored before calling NextResultSet()

commit 0ac9483
Author: jszwec <[email protected]>
Date:   Sun Jan 15 00:50:13 2017 -0500

    Multi-Results improvements

    - support for binary protocol
    - support statements returning no results
    - remove emptyRows

commit c823aa0
Author: jszwec <[email protected]>
Date:   Sun Jan 8 20:46:50 2017 -0500

    Add Multi-Results support

    Fixes go-sql-driver#420
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants