summaryrefslogtreecommitdiff
path: root/src/dal/sqlitedataprovider.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dal/sqlitedataprovider.cpp')
-rw-r--r--src/dal/sqlitedataprovider.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/dal/sqlitedataprovider.cpp b/src/dal/sqlitedataprovider.cpp
index 38001acb..8018098f 100644
--- a/src/dal/sqlitedataprovider.cpp
+++ b/src/dal/sqlitedataprovider.cpp
@@ -51,7 +51,9 @@ SqLiteDataProvider::~SqLiteDataProvider(void)
// make sure that the database is closed.
// disconnect() calls sqlite3_close() which takes care of freeing
// the memory allocated for the handle.
- disconnect();
+ if (mIsConnected) {
+ disconnect();
+ }
}
catch (...) {
// ignore
@@ -169,10 +171,13 @@ SqLiteDataProvider::disconnect(void)
return;
}
+ // sqlite3_close() closes the connection and deallocates the connection
+ // handle.
if (sqlite3_close(mDb) != SQLITE_OK) {
throw DbDisconnectionFailure(sqlite3_errmsg(mDb));
}
+ mDb = 0;
mIsConnected = false;
}