diff options
Diffstat (limited to 'plugins/Dbx_sqlite/src/dbevents.cpp')
-rw-r--r-- | plugins/Dbx_sqlite/src/dbevents.cpp | 7 |
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); |