summaryrefslogtreecommitdiff
path: root/plugins/Dbx_sqlite/src/dbcheck.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2025-04-10 14:03:38 +0300
committerGeorge Hazan <george.hazan@gmail.com>2025-04-10 14:03:38 +0300
commitaeb5c84e9c3a013f0ae12b4a7b2297f6f45dca4c (patch)
tree9bf96a6faa0c0408ba9ebed26ccea418be48638b /plugins/Dbx_sqlite/src/dbcheck.cpp
parente5123d11e822a76eaea81d207b5b2932d04b3ced (diff)
Dbx_Sqlite: fix for database checker & unread events
Diffstat (limited to 'plugins/Dbx_sqlite/src/dbcheck.cpp')
-rw-r--r--plugins/Dbx_sqlite/src/dbcheck.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/Dbx_sqlite/src/dbcheck.cpp b/plugins/Dbx_sqlite/src/dbcheck.cpp
index 661b87f1ff..d6cad456c4 100644
--- a/plugins/Dbx_sqlite/src/dbcheck.cpp
+++ b/plugins/Dbx_sqlite/src/dbcheck.cpp
@@ -93,6 +93,23 @@ int CDbxSQLite::CheckPhase4()
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// update unsynced flags & is_read field
+
+int CDbxSQLite::CheckPhase5()
+{
+ sqlite3_stmt *pQuery;
+ int rc = sqlite3_prepare_v2(m_db, "UPDATE events SET flags = flags | 4 WHERE is_read = 1", -1, &pQuery, nullptr);
+ logError(rc, __FILE__, __LINE__);
+ if (rc)
+ return rc;
+
+ rc = sqlite3_step(pQuery);
+ logError(rc, __FILE__, __LINE__);
+ sqlite3_finalize(pQuery);
+ return 0;
+}
+
///////////////////////////////////////////////////////////////////////////////
// MIDatabaseChecker
@@ -103,6 +120,7 @@ int CDbxSQLite::CheckDb(int phase)
case 1: return CheckPhase2();
case 2: return CheckPhase3();
case 3: return CheckPhase4();
+ case 4: return CheckPhase5();
}
DBFlush(true);