summaryrefslogtreecommitdiff
path: root/plugins/Dbx_sqlite/src/dbsettings.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-01-16 19:30:20 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-01-16 19:30:20 +0300
commitb2a65cb0e93f070ebb78dd69a9740527fb0e6261 (patch)
treee83aac634813a44991f212cbaab43dbab60f37a3 /plugins/Dbx_sqlite/src/dbsettings.cpp
parent97f80dd9e5737bb65cdd2b745c864e9c3b7ab433 (diff)
dbx_sqlite:
- major speed-up (we don't close each transaction immediately); - assert replaced with correct error logging (to be able to debug problems using network logs); - code cleaning; - version bump
Diffstat (limited to 'plugins/Dbx_sqlite/src/dbsettings.cpp')
-rwxr-xr-xplugins/Dbx_sqlite/src/dbsettings.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/Dbx_sqlite/src/dbsettings.cpp b/plugins/Dbx_sqlite/src/dbsettings.cpp
index aab8f5f30c..45c77dbf06 100755
--- a/plugins/Dbx_sqlite/src/dbsettings.cpp
+++ b/plugins/Dbx_sqlite/src/dbsettings.cpp
@@ -100,7 +100,7 @@ BOOL CDbxSQLite::EnumModuleNames(DBMODULEENUMPROC pFunc, void *param)
const char *value = (const char *)sqlite3_column_text(stmt, 0);
modules.insert(mir_strdup(value));
}
- assert(rc == SQLITE_ROW || rc == SQLITE_DONE);
+ logError(rc);
sqlite3_reset(stmt);
}
@@ -142,11 +142,12 @@ BOOL CDbxSQLite::WriteContactSettingWorker(MCONTACT hContact, DBCONTACTWRITESETT
}
int rc = sqlite3_step(stmt);
- assert(rc == SQLITE_ROW || rc == SQLITE_DONE);
+ logError(rc);
sqlite3_reset(stmt);
if (rc != SQLITE_DONE)
return 1;
+ DBFlush();
return 0;
}
@@ -171,15 +172,17 @@ BOOL CDbxSQLite::DeleteContactSetting(MCONTACT hContact, LPCSTR szModule, LPCSTR
sqlite3_bind_text(stmt, 2, szModule, (int)mir_strlen(szModule), nullptr);
sqlite3_bind_text(stmt, 3, szSetting, (int)mir_strlen(szSetting), nullptr);
int rc = sqlite3_step(stmt);
- assert(rc == SQLITE_DONE);
+ logError(rc);
sqlite3_reset(stmt);
stmt = settings_stmts[SQL_SET_STMT_CHANGES].pQuery;
rc = sqlite3_step(stmt);
- assert(rc == SQLITE_ROW);
+ logError(rc);
int deleted = sqlite3_column_int(stmt, 0);
sqlite3_reset(stmt);
if (deleted == 0)
return 1;
+
+ DBFlush();
}
m_cache->GetCachedValuePtr(hContact, szCachedSettingName, -1);
@@ -217,7 +220,7 @@ BOOL CDbxSQLite::EnumContactSettings(MCONTACT hContact, DBSETTINGENUMPROC pfnEnu
const char *value = (const char *)sqlite3_column_text(stmt, 0);
settings.insert(mir_strdup(value));
}
- assert(rc == SQLITE_ROW || rc == SQLITE_DONE);
+ logError(rc);
sqlite3_reset(stmt);
}