Update Statement.cpp

This commit is contained in:
maxbachmann 2019-05-21 17:51:56 +02:00 committed by GitHub
parent 81913790f2
commit 7738989228
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)