Browse Source

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

return first err in mysqlConn.Close
Arne Hormann 11 năm trước cách đây
mục cha
commit
0b11020cec
1 tập tin đã thay đổi với 6 bổ sung2 xóa
  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
 	}