浏览代码

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

Fixes #450
Julien Schmidt 9 年之前
父节点
当前提交
092683484a
共有 1 个文件被更改,包括 4 次插入1 次删除
  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
 	}