summaryrefslogtreecommitdiff
path: root/plugins/Dbx_sqlite/src/dbcontacts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Dbx_sqlite/src/dbcontacts.cpp')
-rwxr-xr-xplugins/Dbx_sqlite/src/dbcontacts.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/plugins/Dbx_sqlite/src/dbcontacts.cpp b/plugins/Dbx_sqlite/src/dbcontacts.cpp
index 23d243f145..f9c32981cf 100755
--- a/plugins/Dbx_sqlite/src/dbcontacts.cpp
+++ b/plugins/Dbx_sqlite/src/dbcontacts.cpp
@@ -32,7 +32,7 @@ void CDbxSQLite::InitContacts()
DBCachedContact *cc = (hContact) ? m_cache->AddContactToCache(hContact) : &m_system;
cc->m_count = sqlite3_column_int64(stmt, 1);
}
- assert(rc == SQLITE_ROW || rc == SQLITE_DONE);
+ logError(rc);
sqlite3_finalize(stmt);
}
@@ -47,7 +47,7 @@ LONG CDbxSQLite::GetContactCount()
mir_cslock lock(m_csDbAccess);
sqlite3_stmt *stmt = ctc_stmts[SQL_CTC_STMT_COUNT].pQuery;
int rc = sqlite3_step(stmt);
- assert(rc == SQLITE_ROW || rc == SQLITE_DONE);
+ logError(rc);
int count = sqlite3_column_int(stmt, 0);
sqlite3_reset(stmt);
return count;
@@ -60,11 +60,12 @@ MCONTACT CDbxSQLite::AddContact()
mir_cslock lock(m_csDbAccess);
sqlite3_stmt *stmt = ctc_stmts[SQL_CTC_STMT_ADD].pQuery;
int rc = sqlite3_step(stmt);
- assert(rc == SQLITE_ROW || rc == SQLITE_DONE);
+ logError(rc);
sqlite3_reset(stmt);
if (rc != SQLITE_DONE)
return INVALID_CONTACT_ID;
hContact = sqlite3_last_insert_rowid(m_db);
+ DBFlush();
}
DBCachedContact *cc = m_cache->AddContactToCache(hContact);
@@ -86,7 +87,7 @@ LONG CDbxSQLite::DeleteContact(MCONTACT hContact)
sqlite3_stmt *stmt = ctc_stmts[SQL_CTC_STMT_DELETEEVENTS].pQuery;
sqlite3_bind_int64(stmt, 1, hContact);
int rc = sqlite3_step(stmt);
- assert(rc == SQLITE_DONE);
+ logError(rc);
sqlite3_reset(stmt);
if (rc != SQLITE_DONE)
return 1;
@@ -94,7 +95,7 @@ LONG CDbxSQLite::DeleteContact(MCONTACT hContact)
stmt = ctc_stmts[SQL_CTC_STMT_DELETEEVENTS_SRT].pQuery;
sqlite3_bind_int64(stmt, 1, hContact);
rc = sqlite3_step(stmt);
- assert(rc == SQLITE_DONE);
+ logError(rc);
sqlite3_reset(stmt);
if (rc != SQLITE_DONE)
return 1;
@@ -102,7 +103,7 @@ LONG CDbxSQLite::DeleteContact(MCONTACT hContact)
stmt = ctc_stmts[SQL_CTC_STMT_DELETESETTINGS].pQuery;
sqlite3_bind_int64(stmt, 1, hContact);
rc = sqlite3_step(stmt);
- assert(rc == SQLITE_DONE);
+ logError(rc);
sqlite3_reset(stmt);
if (rc != SQLITE_DONE)
return 1;
@@ -110,7 +111,7 @@ LONG CDbxSQLite::DeleteContact(MCONTACT hContact)
stmt = ctc_stmts[SQL_CTC_STMT_DELETE].pQuery;
sqlite3_bind_int64(stmt, 1, hContact);
rc = sqlite3_step(stmt);
- assert(rc == SQLITE_DONE);
+ logError(rc);
sqlite3_reset(stmt);
if (rc != SQLITE_DONE)
return 1;
@@ -119,6 +120,8 @@ LONG CDbxSQLite::DeleteContact(MCONTACT hContact)
lock.unlock();
NotifyEventHooks(g_hevContactDeleted, hContact);
+
+ DBFlush();
return 0;
}