Browse Source

Merge pull request #219 from arnehormann/err-on-close

return first err in mysqlConn.Close
Arne Hormann 11 years ago
parent
commit
0b11020cec
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) {
 func (mc *mysqlConn) Close() (err error) {
 	// Makes Close idempotent
 	// Makes Close idempotent
 	if mc.netConn != nil {
 	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
 		mc.netConn = nil
 	}
 	}