summaryrefslogtreecommitdiff
path: root/plugins/Dbx_sqlite/src/dbevents.cpp
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss@sss.chaoslab.ru>2019-05-24 16:16:31 +0300
committerGluzskiy Alexandr <sss@sss.chaoslab.ru>2019-06-05 16:24:36 +0300
commitba5506d869a4472ad86d45ad8c50d500c3e068fb (patch)
tree552a08eb2655acdb0f4fb8d1a016ee2e213ce474 /plugins/Dbx_sqlite/src/dbevents.cpp
parentf6e7c1be2d87482b20d242cc029085dc10cfee86 (diff)
dbx_sqlite: implemented cleaning of events_srt
Diffstat (limited to 'plugins/Dbx_sqlite/src/dbevents.cpp')
-rwxr-xr-xplugins/Dbx_sqlite/src/dbevents.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp
index ae0aad2357..9690eb7f69 100755
--- a/plugins/Dbx_sqlite/src/dbevents.cpp
+++ b/plugins/Dbx_sqlite/src/dbevents.cpp
@@ -18,6 +18,7 @@ enum {
SQL_EVT_STMT_GETIDBYSRVID,
SQL_EVT_STMT_SETSRVID,
SQL_EVT_STMT_ADDEVENT_SRT,
+ SQL_EVT_STMT_DELETE_SRT,
SQL_EVT_STMT_NUM
};
@@ -39,6 +40,7 @@ static char *evt_stmts[SQL_EVT_STMT_NUM] = {
"select id, timestamp from events where module = ? and server_id = ? limit 1;",
"update events set server_id = ? where id = ?;",
"insert into events_srt(id, contact_id, timestamp) values (?, ?, ?);",
+ "delete from events_srt where id = ?;",
};
static sqlite3_stmt *evt_stmts_prep[SQL_EVT_STMT_NUM] = { 0 };
@@ -220,14 +222,22 @@ BOOL CDbxSQLite::DeleteEvent(MCONTACT hContact, MEVENT hDbEvent)
{
mir_cslock lock(m_csDbAccess);
sqlite3_stmt *stmt = evt_stmts_prep[SQL_EVT_STMT_DELETE];
- sqlite3_bind_int64(stmt, 1, hContact);
- sqlite3_bind_int64(stmt, 2, hDbEvent);
+ sqlite3_bind_int64(stmt, 1, hDbEvent);
int rc = sqlite3_step(stmt);
assert(rc == SQLITE_ROW || rc == SQLITE_DONE);
sqlite3_reset(stmt);
if (rc != SQLITE_DONE)
return 1;
+ stmt = evt_stmts_prep[SQL_EVT_STMT_DELETE_SRT];
+ sqlite3_bind_int64(stmt, 1, hDbEvent);
+ rc = sqlite3_step(stmt);
+ assert(rc == SQLITE_ROW || rc == SQLITE_DONE);
+ sqlite3_reset(stmt);
+ if (rc != SQLITE_DONE)
+ return 1;
+
+
cc->DeleteEvent(hDbEvent);
if (cc->IsSub() && (cc = m_cache->GetCachedContact(cc->parentID)))
cc->DeleteEvent(hDbEvent);