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: clarify docs for Tx.Stmt().Close() #16346

Closed
fxposter opened this issue Jul 13, 2016 · 1 comment
Closed

database/sql: clarify docs for Tx.Stmt().Close() #16346

fxposter opened this issue Jul 13, 2016 · 1 comment
Labels
Documentation FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@fxposter
Copy link

Tx.Stmt() example (

// res, err := tx.Stmt(updateMoney).Exec(123.45, 98293203)
) shows the following code:

res, err := tx.Stmt(updateMoney).Exec(123.45, 98293203)

Looking at that code I assume there is no need to explicitly close the Stmt returned from tx.Stmt(updateMoney) because example does not even store references to it.

On the other hand, tests (

defer txs.Close()
and
defer txs.Close()
) are explicitly closing that Stmt.

So I wonder - is there an actual need to .Close() the prepared statements returned from tx.Stmt() or rollback/commit will close them automatically?

/cc @bradfitz

@josharian josharian changed the title Documentation bug(?): database/sql's Tx.Stmt().Close() database/sql: clarify docs for Tx.Stmt().Close() Jul 13, 2016
@josharian josharian added this to the Go1.8 milestone Jul 13, 2016
@quentinmit quentinmit added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 6, 2016
@gopherbot
Copy link

CL https://golang.org/cl/33296 mentions this issue.

@golang golang locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants