From 7738989228e2877599a85e2e09b0424a6101ed0a Mon Sep 17 00:00:00 2001 From: maxbachmann <44199644+maxbachmann@users.noreply.github.com> Date: Tue, 21 May 2019 17:51:56 +0200 Subject: [PATCH] Update Statement.cpp --- src/Statement.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Statement.cpp b/src/Statement.cpp index 5c285d6..df54b8b 100644 --- a/src/Statement.cpp +++ b/src/Statement.cpp @@ -260,7 +260,14 @@ bool Statement::executeStep() const int ret = tryExecuteStep(); if ((SQLITE_ROW != ret) && (SQLITE_DONE != ret)) // on row or no (more) row ready, else it's a problem { - throw SQLite::Exception(mStmtPtr, ret); + if (ret == sqlite3_errcode(mStmtPtr)) + { + throw SQLite::Exception(mStmtPtr, ret); + } + else + { + throw SQLite::Exception("Statement needs to be reseted", ret); + } } return mbHasRow; // true only if one row is accessible by getColumn(N) @@ -276,10 +283,14 @@ int Statement::exec() { throw SQLite::Exception("exec() does not expect results. Use executeStep."); } - else + else if (ret == sqlite3_errcode(mStmtPtr)) { throw SQLite::Exception(mStmtPtr, ret); } + else + { + throw SQLite::Exception("Statement needs to be reseted", ret); + } } // Return the number of rows modified by those SQL statements (INSERT, UPDATE or DELETE)