Prechádzať zdrojové kódy

statment: Remove invalid connection error on multiple Close calls (#512)

Fixes #450
Julien Schmidt 9 rokov pred
rodič
commit
092683484a
1 zmenil súbory, kde vykonal 4 pridanie a 1 odobranie
  1. 4 1
      statement.go

+ 4 - 1
statement.go

@@ -24,7 +24,10 @@ type mysqlStmt struct {
 
 func (stmt *mysqlStmt) Close() error {
 	if stmt.mc == nil || stmt.mc.netConn == nil {
-		errLog.Print(ErrInvalidConn)
+		// driver.Stmt.Close can be called more than once, thus this function
+		// has to be idempotent.
+		// See also Issue #450 and golang/go#16019.
+		//errLog.Print(ErrInvalidConn)
 		return driver.ErrBadConn
 	}