Fix copy lock for prepared statement, close ,

This commit is contained in:
Jinzhu 2020-10-21 15:47:46 +08:00
parent 33a11767ea
commit bdb30da0a7
2 changed files with 2 additions and 1 deletions

View File

@ -117,6 +117,7 @@ func Open(dialector Dialector, config *Config) (db *DB, err error) {
preparedStmt := &PreparedStmtDB{
ConnPool: db.ConnPool,
Stmts: map[string]*sql.Stmt{},
Mux: &sync.RWMutex{},
PreparedSQL: make([]string, 0, 100),
}
db.cacheStore.Store("preparedStmt", preparedStmt)

View File

@ -9,7 +9,7 @@ import (
type PreparedStmtDB struct {
Stmts map[string]*sql.Stmt
PreparedSQL []string
Mux sync.RWMutex
Mux *sync.RWMutex
ConnPool
}