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
Milestone

Comments

@alexbrainman
Copy link
Member

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

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

Comment 2:

Maybe add test too.
Alex

@bradfitz
Copy link
Contributor

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

Comment 4:

Test against fakedb. Just to demonstrate this point.
Alex

@rsc
Copy link
Contributor

rsc commented Sep 12, 2012

Comment 5:

Labels changed: added go1.1.

@rsc
Copy link
Contributor

rsc commented Dec 10, 2012

Comment 6:

Labels changed: added size-m.

@bradfitz
Copy link
Contributor

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
Development

No branches or pull requests

4 participants