diff options
Diffstat (limited to 'plugins/Dbx_sqlite/src')
-rwxr-xr-x | plugins/Dbx_sqlite/src/dbevents.cpp | 16 | ||||
-rwxr-xr-x | plugins/Dbx_sqlite/src/dbintf.cpp | 2 |
2 files changed, 8 insertions, 10 deletions
diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp index dab8fd47b9..a398f58384 100755 --- a/plugins/Dbx_sqlite/src/dbevents.cpp +++ b/plugins/Dbx_sqlite/src/dbevents.cpp @@ -24,11 +24,11 @@ enum { static char *evt_stmts[SQL_EVT_STMT_NUM] = { "select count(1) from events where contact_id = ? limit 1;", - "insert into events(contact_id, module, timestamp, type, flags, size, data) values (?, ?, ?, ?, ?, ?, ?);", + "insert into events(contact_id, module, timestamp, type, flags, data) values (?, ?, ?, ?, ?, ?);", "delete from events where id = ?;", - "update events set module = ?, timestamp = ?, type = ?, flags = ?, size = ?, blob = ? where id = ?;", - "select size from events where id = ? limit 1;", - "select module, timestamp, type, flags, size, data from events where id = ? limit 1;", + "update events set module = ?, timestamp = ?, type = ?, flags = ?, blob = ? where id = ?;", + "select length(data) from events where id = ? limit 1;", + "select module, timestamp, type, flags, length(data), data from events where id = ? limit 1;", "select flags from events where id = ? limit 1;", "update events set flags = ? where id = ?;", "select contact_id from events where id = ? limit 1;", @@ -167,8 +167,7 @@ MEVENT CDbxSQLite::AddEvent(MCONTACT hContact, DBEVENTINFO *dbei) sqlite3_bind_int64(stmt, 3, dbei->timestamp); sqlite3_bind_int(stmt, 4, dbei->eventType); sqlite3_bind_int64(stmt, 5, dbei->flags); - sqlite3_bind_int64(stmt, 6, dbei->cbBlob); - sqlite3_bind_blob(stmt, 7, dbei->pBlob, dbei->cbBlob, nullptr); + sqlite3_bind_blob(stmt, 6, dbei->pBlob, dbei->cbBlob, nullptr); int rc = sqlite3_step(stmt); assert(rc == SQLITE_DONE); sqlite3_reset(stmt); @@ -269,9 +268,8 @@ BOOL CDbxSQLite::EditEvent(MCONTACT hContact, MEVENT hDbEvent, DBEVENTINFO *dbei sqlite3_bind_int64(stmt, 2, dbei->timestamp); sqlite3_bind_int(stmt, 3, dbei->eventType); sqlite3_bind_int64(stmt, 4, dbei->flags); - sqlite3_bind_int64(stmt, 5, dbei->cbBlob); - sqlite3_bind_blob(stmt, 6, dbei->pBlob, dbei->cbBlob, nullptr); - sqlite3_bind_int64(stmt, 7, hDbEvent); + sqlite3_bind_blob(stmt, 5, dbei->pBlob, dbei->cbBlob, nullptr); + sqlite3_bind_int64(stmt, 6, hDbEvent); int rc = sqlite3_step(stmt); assert(rc == SQLITE_DONE); sqlite3_reset(stmt); diff --git a/plugins/Dbx_sqlite/src/dbintf.cpp b/plugins/Dbx_sqlite/src/dbintf.cpp index 6bd71174d3..b66664a222 100755 --- a/plugins/Dbx_sqlite/src/dbintf.cpp +++ b/plugins/Dbx_sqlite/src/dbintf.cpp @@ -33,7 +33,7 @@ int CDbxSQLite::Create(const wchar_t *profile) //TODO: handle error } rc = sqlite3_exec(database, "create table events (id integer not null primary key autoincrement, contact_id integer not null, module text not null," - "timestamp integer not null, type integer not null, flags integer not null, size integer not null, data blob, server_id text);", nullptr, nullptr, nullptr); + "timestamp integer not null, type integer not null, flags integer not null, data blob, server_id text);", nullptr, nullptr, nullptr); if (rc != SQLITE_OK) { //TODO: handle error |