summaryrefslogtreecommitdiff
path: root/telepathy-logger/log-store-sqlite.c
diff options
context:
space:
mode:
authorCosimo Alfarano <cosimo.alfarano@collabora.co.uk>2010-03-15 15:14:04 +0100
committerCosimo Alfarano <cosimo.alfarano@collabora.co.uk>2010-03-15 15:14:04 +0100
commit87534b31199cd4528f04a92a61992027ed4719be (patch)
treebbb765431478b2cd9defd2b976313faaba2e06af /telepathy-logger/log-store-sqlite.c
parente8df07c6c2d7233218238d3bd320ff06b4c86bd5 (diff)
downloadtelepathy-logger-87534b31199cd4528f04a92a61992027ed4719be.tar.gz
Imprioving insert/update in messagecounter
Diffstat (limited to 'telepathy-logger/log-store-sqlite.c')
-rw-r--r--telepathy-logger/log-store-sqlite.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/telepathy-logger/log-store-sqlite.c b/telepathy-logger/log-store-sqlite.c
index f93a72f..60d2ca0 100644
--- a/telepathy-logger/log-store-sqlite.c
+++ b/telepathy-logger/log-store-sqlite.c
@@ -516,7 +516,9 @@ tpl_log_store_sqlite_add_message_counter (TplLogStore *self,
/* update table with new message count */
if (insert)
e = sqlite3_prepare_v2 (priv->db,
- "INSERT INTO messagecounts VALUES (?, ?, ?, date(?), ?)",
+ "INSERT INTO messagecounts "
+ "(messages, account, identifier, chatroom, date) "
+ "VALUES (?, ?, ?, ?, date(?))",
-1, &sql, NULL);
else
e = sqlite3_prepare_v2 (priv->db,
@@ -537,22 +539,11 @@ tpl_log_store_sqlite_add_message_counter (TplLogStore *self,
goto out;
}
- if (insert)
- {
- sqlite3_bind_text (sql, 1, account, -1, SQLITE_TRANSIENT);
- sqlite3_bind_text (sql, 2, identifier, -1, SQLITE_TRANSIENT);
- sqlite3_bind_int (sql, 3, chatroom);
- sqlite3_bind_text (sql, 4, date, -1, SQLITE_TRANSIENT);
- sqlite3_bind_int (sql, 5, count);
- }
- else
- {
- sqlite3_bind_int (sql, 1, count);
- sqlite3_bind_text (sql, 2, account, -1, SQLITE_TRANSIENT);
- sqlite3_bind_text (sql, 3, identifier, -1, SQLITE_TRANSIENT);
- sqlite3_bind_int (sql, 4, chatroom);
- sqlite3_bind_text (sql, 5, date, -1, SQLITE_TRANSIENT);
- }
+ sqlite3_bind_int (sql, 1, count);
+ sqlite3_bind_text (sql, 2, account, -1, SQLITE_TRANSIENT);
+ sqlite3_bind_text (sql, 3, identifier, -1, SQLITE_TRANSIENT);
+ sqlite3_bind_int (sql, 4, chatroom);
+ sqlite3_bind_text (sql, 5, date, -1, SQLITE_TRANSIENT);
e = sqlite3_step (sql);
if (e != SQLITE_DONE)