diff --git a/sqlite3.go b/sqlite3.go index ef06c85..5861a2f 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -1906,14 +1906,14 @@ func (c *SQLiteConn) dbConnOpen() bool { } func (c *SQLiteConn) takeCachedStmt(query string) *SQLiteStmt { - if c == nil || query == "" { + if c == nil || query == "" || c.stmtCacheSize <= 0 { return nil } c.mu.Lock() defer c.mu.Unlock() - if c.db == nil || c.stmtCacheSize <= 0 { + if c.db == nil { return nil } stmts := c.stmtCache[query]