From 6ae2f6b00a9dc496707dcf3b9f762a09b7b84695 Mon Sep 17 00:00:00 2001 From: a631807682 <631807682@qq.com> Date: Wed, 19 Oct 2022 14:21:07 +0800 Subject: [PATCH] fix: close all stmt --- prepare_stmt.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/prepare_stmt.go b/prepare_stmt.go index 0d2ed15eb..a59552d25 100644 --- a/prepare_stmt.go +++ b/prepare_stmt.go @@ -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() + } + db.PreparedSQL = make([]string, 0, 100) db.Stmts = map[string](*Stmt){} }