From f7a7716317dede4687a7fed38aea8d256f4d09e5 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 20 Feb 2013 15:35:27 -0800 Subject: database/sql: refcounting and lifetime fixes Simplifies the contract for Driver.Stmt.Close in the process of fixing issue 3865. Fixes #3865 Update #4459 (maybe fixes it; uninvestigated) R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7363043 --- src/pkg/database/sql/driver/driver.go | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'src/pkg/database/sql/driver') diff --git a/src/pkg/database/sql/driver/driver.go b/src/pkg/database/sql/driver/driver.go index 88c87eeea0..2434e419ba 100644 --- a/src/pkg/database/sql/driver/driver.go +++ b/src/pkg/database/sql/driver/driver.go @@ -115,23 +115,8 @@ type Result interface { type Stmt interface { // Close closes the statement. // - // Closing a statement should not interrupt any outstanding - // query created from that statement. That is, the following - // order of operations is valid: - // - // * create a driver statement - // * call Query on statement, returning Rows - // * close the statement - // * read from Rows - // - // If closing a statement invalidates currently-running - // queries, the final step above will incorrectly fail. - // - // TODO(bradfitz): possibly remove the restriction above, if - // enough driver authors object and find it complicates their - // code too much. The sql package could be smarter about - // refcounting the statement and closing it at the appropriate - // time. + // As of Go 1.1, a Stmt will not be closed if it's in use + // by any queries. Close() error // NumInput returns the number of placeholder parameters. -- cgit v1.3