summaryrefslogtreecommitdiff
path: root/plugins/Dbx_sqlite/src/dbcontacts.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-07-21 17:21:05 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-07-21 17:21:05 +0300
commitf02dcd42ac54c448d5a3af69be87d971326b61b8 (patch)
tree1c7f28c5c7b6f1a442655a026c702c45443059d6 /plugins/Dbx_sqlite/src/dbcontacts.cpp
parent5fd260b7c4c98bfa2d17a301d832a859c2af1f92 (diff)
fixes #4553 (NewStory: проблема с подсчётом числа событий в истории метаконтакта)
Diffstat (limited to 'plugins/Dbx_sqlite/src/dbcontacts.cpp')
-rw-r--r--plugins/Dbx_sqlite/src/dbcontacts.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/plugins/Dbx_sqlite/src/dbcontacts.cpp b/plugins/Dbx_sqlite/src/dbcontacts.cpp
index db392d303d..7f847c44bb 100644
--- a/plugins/Dbx_sqlite/src/dbcontacts.cpp
+++ b/plugins/Dbx_sqlite/src/dbcontacts.cpp
@@ -14,11 +14,17 @@ void CDbxSQLite::InitContacts()
logError(rc, __FILE__, __LINE__);
sqlite3_finalize(stmt);
- sqlite3_prepare_v2(m_db, "SELECT COUNT(1) FROM events_srt WHERE contact_id=0;", -1, &stmt, nullptr);
- rc = sqlite3_step(stmt);
- logError(rc, __FILE__, __LINE__);
- m_system.m_count = sqlite3_column_int64(stmt, 0);
- sqlite3_finalize(stmt);
+ m_system.m_count = GetContactEventCount(0);
+}
+
+int CDbxSQLite::GetContactEventCount(MCONTACT hContact)
+{
+ auto *stmt = InitQuery("SELECT COUNT(1) FROM events_srt WHERE contact_id = ?;", qCntCountEvents);
+ sqlite3_bind_int64(stmt, 1, hContact);
+ logError(sqlite3_step(stmt), __FILE__, __LINE__);
+ int count = sqlite3_column_int64(stmt, 0);
+ sqlite3_reset(stmt);
+ return count;
}
int CDbxSQLite::GetContactCount()