mirror of https://github.com/go-gorm/gorm.git
fix: fix race issue in prepare method (#4487)
This commit is contained in:
parent
6d64e31965
commit
16579e00c6
|
@ -64,7 +64,7 @@ func (db *PreparedStmtDB) prepare(ctx context.Context, conn ConnPool, isTransact
|
||||||
db.Stmts[query] = Stmt{Stmt: stmt, Transaction: isTransaction}
|
db.Stmts[query] = Stmt{Stmt: stmt, Transaction: isTransaction}
|
||||||
db.PreparedSQL = append(db.PreparedSQL, query)
|
db.PreparedSQL = append(db.PreparedSQL, query)
|
||||||
}
|
}
|
||||||
db.Mux.Unlock()
|
defer db.Mux.Unlock()
|
||||||
|
|
||||||
return db.Stmts[query], err
|
return db.Stmts[query], err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue