summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/Dbx_sqlite/src/dbcontacts.cpp27
-rw-r--r--plugins/Dbx_sqlite/src/dbevents.cpp22
-rw-r--r--plugins/Dbx_sqlite/src/dbintf.cpp2
3 files changed, 25 insertions, 26 deletions
diff --git a/plugins/Dbx_sqlite/src/dbcontacts.cpp b/plugins/Dbx_sqlite/src/dbcontacts.cpp
index ad4ed0ec7c..e2bef8664a 100644
--- a/plugins/Dbx_sqlite/src/dbcontacts.cpp
+++ b/plugins/Dbx_sqlite/src/dbcontacts.cpp
@@ -4,13 +4,17 @@ enum {
SQL_CTC_STMT_COUNT = 0,
SQL_CTC_STMT_ADD,
SQL_CTC_STMT_DELETE,
+ SQL_CTC_STMT_DELETESETTINGS,
+ SQL_CTC_STMT_DELETEEVENTS,
SQL_CTC_STMT_NUM
};
static char *ctc_stmts[SQL_CTC_STMT_NUM] = {
"select count(1) from contacts limit 1;",
"insert into contacts values (null);",
- "delete from contacts where id = ?;"
+ "delete from contacts where id = ?;",
+ "delete from settings where contact_id = ?;",
+ "delete from events where contact_id = ?;"
};
static sqlite3_stmt *ctc_stmts_prep[SQL_CTC_STMT_NUM] = { 0 };
@@ -94,10 +98,27 @@ LONG CDbxSQLite::DeleteContact(MCONTACT hContact)
{
mir_cslock lock(m_csDbAccess);
- sqlite3_stmt *stmt = ctc_stmts_prep[SQL_CTC_STMT_DELETE];
+
+ sqlite3_stmt *stmt = ctc_stmts_prep[SQL_CTC_STMT_DELETEEVENTS];
sqlite3_bind_int64(stmt, 1, hContact);
int rc = sqlite3_step(stmt);
- assert(rc == SQLITE_ROW || rc == SQLITE_DONE);
+ assert(rc == SQLITE_DONE);
+ sqlite3_reset(stmt);
+ if (rc != SQLITE_DONE)
+ return 1;
+
+ stmt = ctc_stmts_prep[SQL_CTC_STMT_DELETESETTINGS];
+ sqlite3_bind_int64(stmt, 1, hContact);
+ rc = sqlite3_step(stmt);
+ assert(rc == SQLITE_DONE);
+ sqlite3_reset(stmt);
+ if (rc != SQLITE_DONE)
+ return 1;
+
+ stmt = ctc_stmts_prep[SQL_CTC_STMT_DELETE];
+ sqlite3_bind_int64(stmt, 1, hContact);
+ rc = sqlite3_step(stmt);
+ assert(rc == SQLITE_DONE);
sqlite3_reset(stmt);
if (rc != SQLITE_DONE)
return 1;
diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp
index 5886ac0197..ba4e91236d 100644
--- a/plugins/Dbx_sqlite/src/dbevents.cpp
+++ b/plugins/Dbx_sqlite/src/dbevents.cpp
@@ -17,8 +17,6 @@ enum {
SQL_EVT_STMT_FINDPREV,
SQL_EVT_STMT_GETIDBYSRVID,
SQL_EVT_STMT_SETSRVID,
- SQL_EVT_STMT_MERGE,
- SQL_EVT_STMT_SPLIT,
SQL_EVT_STMT_NUM
};
@@ -39,8 +37,6 @@ static char *evt_stmts[SQL_EVT_STMT_NUM] = {
"select id, timestamp from events where contact_id = ?1 and id <> ?2 and timestamp < (select timestamp from events where contact_id = ?1 and id = ?2 limit 1) order by timestamp desc, id desc limit 1;",
"select id, timestamp from events where module = ? and server_id = ? limit 1;",
"update events set server_id = ? where id = ?;",
- "insert into contact_events(contact_id, event_id, timestamp) select ?1, event_id, timestamp from contact_events where contact_id = ?2 order by timestamp, event_id;",
- "delete from contact_events where contact_id = ? and event_id in (select event_id from contact_events where contact_id = ?);",
};
static sqlite3_stmt *evt_stmts_prep[SQL_EVT_STMT_NUM] = { 0 };
@@ -702,27 +698,9 @@ BOOL CDbxSQLite::SetEventId(LPCSTR, MEVENT hDbEvent, LPCSTR szId)
BOOL CDbxSQLite::MetaMergeHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub)
{
return TRUE;
- /*mir_cslock lock(m_csDbAccess);
- sqlite3_stmt *stmt = evt_stmts_prep[SQL_EVT_STMT_MERGE];
- sqlite3_bind_int64(stmt, 1, ccMeta->contactID);
- sqlite3_bind_int64(stmt, 2, ccSub->contactID);
- int rc = sqlite3_step(stmt);
- assert(rc == SQLITE_ROW || rc == SQLITE_DONE);
- sqlite3_reset(stmt);
- ccMeta->first = ccMeta->unread = ccMeta->last = 0;
- return (rc != SQLITE_DONE);*/
}
BOOL CDbxSQLite::MetaSplitHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub)
{
return TRUE;
- /*mir_cslock lock(m_csDbAccess);
- sqlite3_stmt *stmt = evt_stmts_prep[SQL_EVT_STMT_MERGE];
- sqlite3_bind_int64(stmt, 1, ccMeta->contactID);
- sqlite3_bind_int64(stmt, 2, ccSub->contactID);
- int rc = sqlite3_step(stmt);
- assert(rc == SQLITE_ROW || rc == SQLITE_DONE);
- sqlite3_reset(stmt);
- ccMeta->first = ccMeta->unread = ccMeta->last = 0;
- return (rc != SQLITE_DONE);*/
} \ No newline at end of file
diff --git a/plugins/Dbx_sqlite/src/dbintf.cpp b/plugins/Dbx_sqlite/src/dbintf.cpp
index 1109eb6784..7809e18059 100644
--- a/plugins/Dbx_sqlite/src/dbintf.cpp
+++ b/plugins/Dbx_sqlite/src/dbintf.cpp
@@ -102,7 +102,7 @@ BOOL CDbxSQLite::Compact()
return 0;
}
-BOOL CDbxSQLite::Backup(const wchar_t *profile)
+BOOL CDbxSQLite::Backup(LPCWSTR profile)
{
sqlite3 *database = nullptr;
ptrA path(mir_utf8encodeW(profile));