diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-10 16:21:26 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-10 16:21:26 +0100 |
commit | 698b03d48c675796792b0fdeaf03602f88e73cc0 (patch) | |
tree | 7d742e56c03992da6ce8f216da83b1e58098ce5b /src/libstat/backends/sqlite3_backend.c | |
parent | 09f2ef070f2afc9c6d7939ddc867f6fa3ca5545d (diff) | |
download | rspamd-698b03d48c675796792b0fdeaf03602f88e73cc0.tar.gz rspamd-698b03d48c675796792b0fdeaf03602f88e73cc0.zip |
Fix some minor issues with sqlite3.
Diffstat (limited to 'src/libstat/backends/sqlite3_backend.c')
-rw-r--r-- | src/libstat/backends/sqlite3_backend.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/libstat/backends/sqlite3_backend.c b/src/libstat/backends/sqlite3_backend.c index 90c184ae3..2d8ae1921 100644 --- a/src/libstat/backends/sqlite3_backend.c +++ b/src/libstat/backends/sqlite3_backend.c @@ -427,7 +427,7 @@ rspamd_sqlite3_learn_token (struct rspamd_task *task, struct token_node_s *tok, if (rspamd_sqlite3_run_prstmt (bk->sqlite, bk->prstmt, RSPAMD_STAT_BACKEND_SET_TOKEN, - idx, rt->user_id, rt->lang_id, iv) == SQLITE_OK) { + idx, rt->user_id, rt->lang_id, iv) != SQLITE_OK) { return FALSE; } @@ -482,6 +482,13 @@ rspamd_sqlite3_inc_learns (struct rspamd_task *task, gpointer runtime, rspamd_sqlite3_run_prstmt (bk->sqlite, bk->prstmt, RSPAMD_STAT_BACKEND_INC_LEARNS, SQLITE3_DEFAULT, SQLITE3_DEFAULT); + + if (bk->in_transaction) { + rspamd_sqlite3_run_prstmt (bk->sqlite, bk->prstmt, + RSPAMD_STAT_BACKEND_TRANSACTION_COMMIT); + bk->in_transaction = FALSE; + } + rspamd_sqlite3_run_prstmt (bk->sqlite, bk->prstmt, RSPAMD_STAT_BACKEND_GET_LEARNS, &res); @@ -501,6 +508,13 @@ rspamd_sqlite3_dec_learns (struct rspamd_task *task, gpointer runtime, rspamd_sqlite3_run_prstmt (bk->sqlite, bk->prstmt, RSPAMD_STAT_BACKEND_DEC_LEARNS, SQLITE3_DEFAULT, SQLITE3_DEFAULT); + + if (bk->in_transaction) { + rspamd_sqlite3_run_prstmt (bk->sqlite, bk->prstmt, + RSPAMD_STAT_BACKEND_TRANSACTION_COMMIT); + bk->in_transaction = FALSE; + } + rspamd_sqlite3_run_prstmt (bk->sqlite, bk->prstmt, RSPAMD_STAT_BACKEND_GET_LEARNS, &res); |