2
0

Fix panic on query error with nil stmtcache

fixes #895
This commit is contained in:
Jack Christensen
2020-12-19 10:17:41 -06:00
parent e8f959e0e1
commit 9b0e57c4a9
2 changed files with 26 additions and 1 deletions
+1 -1
View File
@@ -150,7 +150,7 @@ func (rows *connRows) Close() {
if rows.logger.shouldLog(LogLevelError) {
rows.logger.log(rows.ctx, LogLevelError, "Query", map[string]interface{}{"err": rows.err, "sql": rows.sql, "args": logQueryArgs(rows.args)})
}
if rows.err != nil {
if rows.err != nil && rows.conn.stmtcache != nil {
rows.conn.stmtcache.StatementErrored(rows.sql, rows.err)
}
}