Browse Source

return first err in mysqlConn.Close

Arne Hormann 11 years ago
parent
commit
a91e2c1b9b
1 changed files with 6 additions and 2 deletions
  1. 6 2
      connection.go

+ 6 - 2
connection.go

@@ -113,8 +113,12 @@ func (mc *mysqlConn) Begin() (driver.Tx, error) {
 func (mc *mysqlConn) Close() (err error) {
 	// Makes Close idempotent
 	if mc.netConn != nil {
-		mc.writeCommandPacket(comQuit)
-		mc.netConn.Close()
+		err = mc.writeCommandPacket(comQuit)
+		if err == nil {
+			err = mc.netConn.Close()
+		} else {
+			mc.netConn.Close()
+		}
 		mc.netConn = nil
 	}