ormin icon indicating copy to clipboard operation
ormin copied to clipboard

sqlite: tryQuery doesn't save you from errors

Open alaviss opened this issue 5 years ago • 0 comments

This is the code used for tryQuery:

if stepQuery(db, prepStmt, returnsData):
  action
stopQuery(db, prepStmt)

Which appears to be designed to not throw any errors on failure, but:

template stopQuery*(db: DbConn; s: PStmt) =
  if sqlite3.reset(s) != SQLITE_OK: dbError(db)

Which will throw the last error occurred from executing the statement, see sqlite3_reset() documentation

alaviss avatar Feb 27 '20 19:02 alaviss