diff options
author | George Hazan <ghazan@miranda.im> | 2023-01-01 14:58:25 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-01-01 14:58:25 +0300 |
commit | f828d2569303fa4b26bee503dc9f438fd1fe0c7d (patch) | |
tree | b931297e575f6038eb9056c03dc50b3d01606998 | |
parent | b453b95cae4275f3f79ef229bed8e337a6b58f83 (diff) |
fixes #3290 completely + fix for the database checker
-rw-r--r-- | plugins/DbChecker/src/worker.cpp | 5 | ||||
-rw-r--r-- | plugins/Dbx_sqlite/src/dbevents.cpp | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/plugins/DbChecker/src/worker.cpp b/plugins/DbChecker/src/worker.cpp index 5527e3509a..6be8262b5f 100644 --- a/plugins/DbChecker/src/worker.cpp +++ b/plugins/DbChecker/src/worker.cpp @@ -26,6 +26,11 @@ static bool ConvertOldEvent(DBEVENTINFO &dbei) if (dbei.flags & DBEF_UTF) return false; + if (dbei.flags == 1) { + dbei.flags = DBEF_UTF; + return true; + } + int msglen = (int)mir_strlen((char *)dbei.pBlob) + 1, msglenW = 0; if (msglen != (int)dbei.cbBlob) { int count = ((dbei.cbBlob - msglen) / sizeof(wchar_t)); diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp index cd844c9089..433cae1852 100644 --- a/plugins/Dbx_sqlite/src/dbevents.cpp +++ b/plugins/Dbx_sqlite/src/dbevents.cpp @@ -231,8 +231,8 @@ BOOL CDbxSQLite::EditEvent(MCONTACT hContact, MEVENT hDbEvent, const DBEVENTINFO sqlite3_bind_int(stmt, 3, tmp.eventType); sqlite3_bind_int64(stmt, 4, tmp.flags); sqlite3_bind_blob(stmt, 5, tmp.pBlob, tmp.cbBlob, nullptr); - sqlite3_bind_int64(stmt, 6, hDbEvent); - sqlite3_bind_int(stmt, 7, tmp.markedRead()); + sqlite3_bind_int(stmt, 6, tmp.markedRead()); + sqlite3_bind_int64(stmt, 7, hDbEvent); int rc = sqlite3_step(stmt); logError(rc, __FILE__, __LINE__); sqlite3_reset(stmt); @@ -342,7 +342,7 @@ BOOL CDbxSQLite::MarkEventRead(MCONTACT hContact, MEVENT hDbEvent) int rows; { mir_cslock lock(m_csDbAccess); - sqlite3_stmt *stmt = InitQuery("UPDATE events SET flags = flags OR 4, is_read = 1 WHERE id = ? AND is_read = 0;", qEvSetFlags); + sqlite3_stmt *stmt = InitQuery("UPDATE events SET flags = flags | 4, is_read = 1 WHERE id = ? AND is_read = 0;", qEvSetFlags); sqlite3_bind_int64(stmt, 1, hDbEvent); int rc = sqlite3_step(stmt); rows = sqlite3_changes(m_db); |