diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-03-01 19:55:47 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-03-04 10:02:21 +0100 |
commit | aed3f8be2d96dce957de6884944ea666aadc5bd2 (patch) | |
tree | e4157c22b141623a08fcd76212e1f8ae483bcb10 /src | |
parent | f08b62e1a0b9719bb03fd0db89353f69f0680def (diff) | |
download | manaserv-aed3f8be2d96dce957de6884944ea666aadc5bd2.tar.gz manaserv-aed3f8be2d96dce957de6884944ea666aadc5bd2.tar.bz2 manaserv-aed3f8be2d96dce957de6884944ea666aadc5bd2.tar.xz manaserv-aed3f8be2d96dce957de6884944ea666aadc5bd2.zip |
SQLite: Added a timeout for trying to acquire a database lock
Without a timeout, trying to write to a locked database fails immediately.
Now it will only fail when it can't retrieve a write lock within a second.
Still, we need to go through all the SQLite code some time, since there
is a lot of error handling missing. We also need to make sure that errors
are handled correctly on the higher level.
Reviewed-by: Yohann Ferreira
Diffstat (limited to 'src')
-rw-r--r-- | src/dal/sqlitedataprovider.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/dal/sqlitedataprovider.cpp b/src/dal/sqlitedataprovider.cpp index 2e005d9d..a47c9862 100644 --- a/src/dal/sqlitedataprovider.cpp +++ b/src/dal/sqlitedataprovider.cpp @@ -95,6 +95,10 @@ void SqLiteDataProvider::connect() throw DbConnectionFailure(msg); } + // Wait up to one second when the database is busy. This should make sure + // transaction failures due to locked databases are very rare. + sqlite3_busy_timeout(mDb, 1000); + // Save the Db Name. mDbName = dbName; |