diff options
author | George Hazan <george.hazan@gmail.com> | 2023-10-02 14:15:18 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-10-02 14:15:18 +0300 |
commit | fb7edbe76a928d134fd334e5bad68e32096e0424 (patch) | |
tree | 34b5f491d81a1b930e819d4b8d6fcc420c515567 /plugins/Dbx_sqlite | |
parent | a6821e1eefdbd4c428a62bfd41cb2bf1f9fa7f39 (diff) |
fixes #3700 )dbx_sqlite: удаление истории метаконтакта оставляет пустые события)
Diffstat (limited to 'plugins/Dbx_sqlite')
-rw-r--r-- | plugins/Dbx_sqlite/src/dbevents.cpp | 9 | ||||
-rw-r--r-- | plugins/Dbx_sqlite/src/dbintf.cpp | 3 | ||||
-rw-r--r-- | plugins/Dbx_sqlite/src/dbintf.h | 2 | ||||
-rw-r--r-- | plugins/Dbx_sqlite/src/dbsettings.cpp | 9 | ||||
-rw-r--r-- | plugins/Dbx_sqlite/src/version.h | 4 |
5 files changed, 16 insertions, 11 deletions
diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp index 70766e48b1..ac2261c60d 100644 --- a/plugins/Dbx_sqlite/src/dbevents.cpp +++ b/plugins/Dbx_sqlite/src/dbevents.cpp @@ -198,11 +198,10 @@ int CDbxSQLite::DeleteEventSrt(MCONTACT hContact, int64_t ts) return rc;
}
-int CDbxSQLite::DeleteEventSrt2(MCONTACT hContact, MEVENT hDbEvent)
+int CDbxSQLite::DeleteEventSrt2(MEVENT hDbEvent)
{
- auto *stmt = InitQuery("DELETE FROM events_srt WHERE contact_id = ? AND id = ?;", qEvDelSrt2);
- sqlite3_bind_int64(stmt, 1, hContact);
- sqlite3_bind_int64(stmt, 2, hDbEvent);
+ auto *stmt = InitQuery("DELETE FROM events_srt WHERE id = ?;", qEvDelSrt2);
+ sqlite3_bind_int64(stmt, 1, hDbEvent);
int rc = sqlite3_step(stmt);
logError(rc, __FILE__, __LINE__);
sqlite3_reset(stmt);
@@ -239,7 +238,7 @@ BOOL CDbxSQLite::DeleteEvent(MEVENT hDbEvent) if (rc != SQLITE_DONE)
return 1;
- rc = DeleteEventSrt2(hContact, hDbEvent);
+ rc = DeleteEventSrt2(hDbEvent);
if (rc != SQLITE_DONE)
return 1;
diff --git a/plugins/Dbx_sqlite/src/dbintf.cpp b/plugins/Dbx_sqlite/src/dbintf.cpp index a7596ec9bb..70d35e9fbf 100644 --- a/plugins/Dbx_sqlite/src/dbintf.cpp +++ b/plugins/Dbx_sqlite/src/dbintf.cpp @@ -61,6 +61,9 @@ int CDbxSQLite::Create() rc = sqlite3_exec(m_db, "CREATE TABLE events_srt (id INTEGER NOT NULL, contact_id INTEGER NOT NULL, timestamp INTEGER, PRIMARY KEY(contact_id, timestamp));", nullptr, nullptr, nullptr);
logError(rc, __FILE__, __LINE__);
+ rc = sqlite3_exec(m_db, "CREATE INDEX i1_srt ON events_srt(id);", nullptr, nullptr, nullptr);
+ logError(rc, __FILE__, __LINE__);
+
rc = sqlite3_exec(m_db, "CREATE TABLE settings (contact_id INTEGER NOT NULL, module TEXT NOT NULL, setting TEXT NOT NULL, type INTEGER NOT NULL, value NOT NULL,"
"PRIMARY KEY(contact_id, module, setting)) WITHOUT ROWID;", nullptr, nullptr, nullptr);
logError(rc, __FILE__, __LINE__);
diff --git a/plugins/Dbx_sqlite/src/dbintf.h b/plugins/Dbx_sqlite/src/dbintf.h index 7f6447ffd7..85183f35a7 100644 --- a/plugins/Dbx_sqlite/src/dbintf.h +++ b/plugins/Dbx_sqlite/src/dbintf.h @@ -85,7 +85,7 @@ class CDbxSQLite : public MDatabaseCommon, public MIDatabaseChecker, public MZer int AddEventSrt(MEVENT, MCONTACT, int64_t ts);
int DeleteEventMain(MEVENT);
int DeleteEventSrt(MCONTACT, int64_t ts);
- int DeleteEventSrt2(MCONTACT, MEVENT);
+ int DeleteEventSrt2(MEVENT);
// settings
void InitSettings();
diff --git a/plugins/Dbx_sqlite/src/dbsettings.cpp b/plugins/Dbx_sqlite/src/dbsettings.cpp index 691b3921f1..dfc3bddf85 100644 --- a/plugins/Dbx_sqlite/src/dbsettings.cpp +++ b/plugins/Dbx_sqlite/src/dbsettings.cpp @@ -127,11 +127,14 @@ void CDbxSQLite::InitSettings() dbv.bVal = 3;
}
- if (dbv.bVal < 4) {
- int rc = sqlite3_exec(m_db, "CREATE INDEX i1_srt ON events_srt(contact_id, id);", 0, 0, 0);
+ if (dbv.bVal < 5) {
+ int rc = sqlite3_exec(m_db, "DROP INDEX IF EXISTS i1_srt;", 0, 0, 0);
logError(rc, __FILE__, __LINE__);
- dbv.bVal = 4;
+ rc = sqlite3_exec(m_db, "CREATE INDEX i1_srt ON events_srt(id);", 0, 0, 0);
+ logError(rc, __FILE__, __LINE__);
+
+ dbv.bVal = 5;
WriteContactSetting(0, "Compatibility", "Sqlite", &dbv);
}
}
diff --git a/plugins/Dbx_sqlite/src/version.h b/plugins/Dbx_sqlite/src/version.h index 32cba5986e..1ec1dd66b4 100644 --- a/plugins/Dbx_sqlite/src/version.h +++ b/plugins/Dbx_sqlite/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 96
-#define __RELEASE_NUM 2
-#define __BUILD_NUM 4
+#define __RELEASE_NUM 4
+#define __BUILD_NUM 1
#include <stdver.h>
|