summaryrefslogtreecommitdiff
path: root/src/dal
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-01 19:55:47 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-04 10:02:21 +0100
commitaed3f8be2d96dce957de6884944ea666aadc5bd2 (patch)
treee4157c22b141623a08fcd76212e1f8ae483bcb10 /src/dal
parentf08b62e1a0b9719bb03fd0db89353f69f0680def (diff)
downloadmanaserv-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/dal')
-rw-r--r--src/dal/sqlitedataprovider.cpp4
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;