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

database/sql: document that it is valid to have multiple Rows for the same Stmt #3734

Closed
alexbrainman opened this issue Jun 14, 2012 · 7 comments
Closed
Assignees
Milestone

Comments

@alexbrainman
Copy link
Member

@alexbrainman alexbrainman commented Jun 14, 2012

I think, this:

stmt, _ := db.Prepare("select name from people")
defer stms.Close()
rows1, _ := stmt.Query()
rows2, _ := stmt.Query()
// do things with rows1 and rows2 in any order

is valid.

Alex
@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jun 14, 2012

Comment 1:

Yes, that's valid.
I could add some more docs on *DB.Prepare.

Labels changed: removed priority-triage.

@alexbrainman
Copy link
Member Author

@alexbrainman alexbrainman commented Jun 14, 2012

Comment 2:

Maybe add test too.
Alex
@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jun 14, 2012

Comment 3:

There are tests (IIRC) in https://github.com/bradfitz/go-sql-test but it's hard to add
tests in the standard library, since the standard library doesn't contain drivers.
@alexbrainman
Copy link
Member Author

@alexbrainman alexbrainman commented Jun 14, 2012

Comment 4:

Test against fakedb. Just to demonstrate this point.
Alex
@rsc
Copy link
Contributor

@rsc rsc commented Sep 12, 2012

Comment 5:

Labels changed: added go1.1.

@rsc
Copy link
Contributor

@rsc rsc commented Dec 10, 2012

Comment 6:

Labels changed: added size-m.

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Feb 21, 2013

Comment 7:

This issue was closed by revision c53fab9.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.