summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2018-09-23 01:30:29 +0300
committeraunsane <aunsane@gmail.com>2018-09-23 01:30:39 +0300
commit89a3160416316af2ff0b8de9b247583a4ac103f8 (patch)
treeaa80a91a3db84bc66f4e1184ca9b76e15266609c
parent2f7fbc2c8e8ff8b4c53a2f5019ae512617206f87 (diff)
dbx_sqlite: fix events queries
-rw-r--r--plugins/Dbx_sqlite/src/dbevents.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp
index bff8362c41..d131681409 100644
--- a/plugins/Dbx_sqlite/src/dbevents.cpp
+++ b/plugins/Dbx_sqlite/src/dbevents.cpp
@@ -20,8 +20,8 @@ enum {
};
static char *evt_stmts[SQL_EVT_STMT_NUM] = {
- "select count(1) from events limit 1;",
- "insert into events values (null, ?, ?, ?, ?, ?, ?, ?);",
+ "select count(1) from events where contactid = ? limit 1;",
+ "insert into events(contactid, module, timestamp, type, flags, size, blob) values (?, ?, ?, ?, ?, ?, ?);",
"delete from events where id = ?;",
"select size from events where id = ? limit 1;",
"select module, timestamp, flags, type, size, blob from events where id = ? limit 1;",
@@ -132,6 +132,9 @@ BOOL CDbxSQLite::DeleteEvent(MCONTACT hContact, MEVENT hDbEvent)
LONG CDbxSQLite::GetBlobSize(MEVENT hDbEvent)
{
+ if (hDbEvent == 0)
+ return -1;
+
mir_cslock lock(m_csDbAccess);
sqlite3_stmt *stmt = evt_stmts_prep[SQL_EVT_STMT_BLOBSIZE];
sqlite3_bind_int(stmt, 1, hDbEvent);