Skip to content
Snippets Groups Projects
Commit 89902588 authored by Steven Murray's avatar Steven Murray
Browse files

SqliteStmt now uses DEFERRED transactions

parent a88c22b4
No related branches found
No related tags found
No related merge requests found
......@@ -84,7 +84,7 @@ SqliteStmt::SqliteStmt(
break;
case AutocommitMode::OFF: {
if(!m_conn.m_transactionInProgress) {
beginExclusiveTransaction();
beginDeferredTransaction();
m_conn.m_transactionInProgress = true;
}
break;
......@@ -249,12 +249,12 @@ uint64_t SqliteStmt::getNbAffectedRows() const {
}
//------------------------------------------------------------------------------
// beginExclusiveTransaction
// beginDeferredTransaction
//------------------------------------------------------------------------------
void SqliteStmt::beginExclusiveTransaction() {
void SqliteStmt::beginDeferredTransaction() {
try {
char *errMsg = nullptr;
if(SQLITE_OK != sqlite3_exec(m_conn.m_sqliteConn, "BEGIN EXCLUSIVE", nullptr, nullptr, &errMsg)) {
if(SQLITE_OK != sqlite3_exec(m_conn.m_sqliteConn, "BEGIN DEFERRED", nullptr, nullptr, &errMsg)) {
exception::Exception ex;
ex.getMessage() << "sqlite3_exec failed";
if(nullptr != errMsg) {
......
......@@ -172,13 +172,13 @@ private:
uint64_t m_nbAffectedRows;
/**
* Begins an SQLite exclusive transaction.
* Begins an SQLite deferred transaction.
*
* This method is called by the constructor which in turn was called by the
* SqliteStmt::createStmt() method and assumes that a lock has already been
* taken on SqliteStmt::m_mutex;
*/
void beginExclusiveTransaction();
void beginDeferredTransaction();
}; // class SqlLiteStmt
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment