Sqlite: Throw IoError in SqliteStatement::prepareStatement

If we get this any hope is lost any way but we now know why. ;-)

Change-Id: Ic08b104825dc51ce5453203e70a0804265e47330
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2018-03-29 18:31:02 +02:00
parent b6c038924c
commit 5e42bbc7fb
2 changed files with 8 additions and 1 deletions

View File

@@ -280,7 +280,8 @@ void BaseStatement::checkForPrepareError(int resultCode) const
switch (resultCode) {
case SQLITE_BUSY: throwStatementIsBusy("SqliteStatement::prepareStatement: database engine was unable to acquire the database locks!");
case SQLITE_ERROR : throwStatementHasError("SqliteStatement::prepareStatement: run-time error (such as a constraint violation) has occurred!");
case SQLITE_MISUSE: throwStatementIsMisused("SqliteStatement::prepareStatement: was called inappropriately!");
case SQLITE_MISUSE: throwStatementIsMisused("SqliteStatement::prepareStatement: was called inappropriately!");
case SQLITE_IOERR: throwIoError("SqliteStatement::prepareStatement: IO error happened!");
}
throwUnknowError("SqliteStatement::prepareStatement: unknown error has happened");
@@ -370,6 +371,11 @@ void BaseStatement::throwStatementIsMisused(const char *whatHasHappened) const
throw StatementIsMisused(whatHasHappened, sqlite3_errmsg(sqliteDatabaseHandle()));
}
void BaseStatement::throwIoError(const char *whatHasHappened) const
{
throw IoError(whatHasHappened);
}
void BaseStatement::throwConstraintPreventsModification(const char *whatHasHappened) const
{
throw ConstraintPreventsModification(whatHasHappened, sqlite3_errmsg(sqliteDatabaseHandle()));