Browse Source

mysql关闭rows

wangkaiyue 6 years ago
parent
commit
9eedcaf80c
1 changed files with 2 additions and 3 deletions
  1. 2 3
      common/src/qfw/util/mysql/mysql.go

+ 2 - 3
common/src/qfw/util/mysql/mysql.go

@@ -235,9 +235,8 @@ func (m *Mysql) QueryCount(query string, args ...interface{}) (count int) {
 		log.Println(err)
 		return
 	}
-	if err != nil {
-		log.Println(err)
-		return
+	if rows != nil {
+		defer rows.Close()
 	}
 	if rows.Next() {
 		err = rows.Scan(&count)