Clang: Handle constraint exceptions in the file path storage

It can be happen that the entry is written by an other connection after
we tried to read and before we write. This would lead to a double entry
which be prevented by the unique index in the database. In that case we
simply try again and read the id from the database.

Change-Id: I6c9d94e95ae11556bb446813f64be0855be4ddbe
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2018-04-03 14:34:51 +02:00
parent c5f9765c93
commit 23865a102d
4 changed files with 108 additions and 8 deletions

View File

@@ -372,7 +372,7 @@ void BaseStatement::throwStatementIsMisused(const char *whatHasHappened) const
void BaseStatement::throwConstraintPreventsModification(const char *whatHasHappened) const
{
throw ContraintPreventsModification(whatHasHappened, sqlite3_errmsg(sqliteDatabaseHandle()));
throw ConstraintPreventsModification(whatHasHappened, sqlite3_errmsg(sqliteDatabaseHandle()));
}
void BaseStatement::throwNoValuesToFetch(const char *whatHasHappened) const