-
Notifications
You must be signed in to change notification settings - Fork 917
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
Add support for retrieving multiple results. #425
Conversation
This is very clever, and I can see the utility, but I'm really skeptical of adding hacks like this... I'd like to hear opinions from other committers or the community. |
Besides adding new functionality, this fixes the processing of results in queries that contain multiple statements. Consider the query I'm not terribly thrilled with the usage of |
I really would rather not see hacks like this. If database/sql doesn't support something, why not suggest improvements over there? |
There is an issue filed upstream about this: golang/go#12382 |
Now that might be worth fixing. I'm not sure whether we should throw away result sets after the first one (the opposite of what e.g. libpq does), or whether to simply clean up correctly and return an error. Has anyone checked what the behavior of libpq with the streaming interface is? |
73fc92e
to
95bc43c
Compare
Reworked how the msg-ready command (`Z`) is processed. Previously execution of a query would look for the msg-ready command before completing the operation. Now, when executing a query, the driver places the connection into a state where it knows there may be more results. If another query is subsequently executed, the driver waits for the msg-ready command to arrive, discarding any other commands, before sending the new query.
95bc43c
to
cca0657
Compare
If the special `NEXT` query is executed, the driver looks for another set of results on the connection. If no such results are found, ErrNoMoreResults is returned.
cca0657
to
4bc2416
Compare
Support for multiple result sets has been merged into |
Note that such support will need to live behind an appropriate build tag, and has no business being merged before 1.8 is out. It'd be cool to see it working, though. |
@tamird On the contrary, it may be implemented as additional methods and the sql package will detect support. No build tags are required. Also, I have yet to make this general request, but I'll start with the request here: There are many new features in |
Ah, of course you're right. It would be great if there was somewhere to look at a live list of those updates. Here's the few that I've found: |
@tamird I'll get a list together within a week or two and include it in a more general announcement. Maybe I'll start with opening a single issue on each database drivers that link to a living google docs that contains a list to all the different interfaces / descriptions. |
That would be awesome. On Mon, Oct 17, 2016 at 11:48 AM Daniel Theophanes notifications@github.com
|
Is this PR still relevant with the upcoming Go 1.8 release supporting multiple result sets? |
No, this PR isn't needed. We previously merged this support with another implementation: #532 |
Reworked how the msg-ready command (
Z
) is processed. Previouslyexecution of a query would look for the msg-ready command before
completing the operation. Now, when executing a query, the driver places
the connection into a state where it knows there may be more results. If
another query is subsequently executed, the driver waits for the
msg-ready command to arrive, discarding any other commands, before
sending the new query. But if the special
NEXT
query is executed, thedriver looks for another set of results on the connection. If no such
results are found, ErrNoMoreResults is returned.