Skip to content

Commit

Permalink
fix: close all stmt
Browse files Browse the repository at this point in the history
  • Loading branch information
a631807682 committed Oct 19, 2022
1 parent 638805e commit 6ae2f6b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion prepare_stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ func (db *PreparedStmtDB) Close() {
}

func (db *PreparedStmtDB) Reset() {
db.Close()
db.Mux.Lock()
defer db.Mux.Unlock()
for _, stmt := range db.Stmts {
go stmt.Close()

This comment has been minimized.

Copy link
@jinzhu

jinzhu Oct 19, 2022

Member

Need to delete keys one by one from Stmts or maybe the global *PrepareStmtDB caches won't be updated

}

db.PreparedSQL = make([]string, 0, 100)
db.Stmts = map[string](*Stmt){}
}
Expand Down

0 comments on commit 6ae2f6b

Please sign in to comment.