diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-18 16:52:34 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-18 16:52:34 +0000 |
commit | 9afc6861062565e91229a8bb3a15f7dc97303c99 (patch) | |
tree | 7f02fcf2c0f3ed2a2c5c2e97cbec8a338f5fb9ce /src | |
parent | e626098891cc44d4890f186d96aa7a99e4acd124 (diff) | |
download | rspamd-9afc6861062565e91229a8bb3a15f7dc97303c99.tar.gz rspamd-9afc6861062565e91229a8bb3a15f7dc97303c99.zip |
Clear bindings for sqlite3 statements
Diffstat (limited to 'src')
-rw-r--r-- | src/libstat/backends/sqlite3_backend.c | 21 | ||||
-rw-r--r-- | src/libutil/sqlite_utils.c | 2 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/libstat/backends/sqlite3_backend.c b/src/libstat/backends/sqlite3_backend.c index 47318d766..c980ddf54 100644 --- a/src/libstat/backends/sqlite3_backend.c +++ b/src/libstat/backends/sqlite3_backend.c @@ -122,7 +122,8 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .args = "", .stmt = NULL, .result = SQLITE_DONE, - .ret = "" + .flags = 0, + .ret = "", }, [RSPAMD_STAT_BACKEND_TRANSACTION_START_DEF] = { .idx = RSPAMD_STAT_BACKEND_TRANSACTION_START_DEF, @@ -130,6 +131,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .args = "", .stmt = NULL, .result = SQLITE_DONE, + .flags = 0, .ret = "" }, [RSPAMD_STAT_BACKEND_TRANSACTION_START_EXCL] = { @@ -138,6 +140,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .args = "", .stmt = NULL, .result = SQLITE_DONE, + .flags = 0, .ret = "" }, [RSPAMD_STAT_BACKEND_TRANSACTION_COMMIT] = { @@ -146,6 +149,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .args = "", .stmt = NULL, .result = SQLITE_DONE, + .flags = 0, .ret = "" }, [RSPAMD_STAT_BACKEND_TRANSACTION_ROLLBACK] = { @@ -154,6 +158,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .args = "", .stmt = NULL, .result = SQLITE_DONE, + .flags = 0, .ret = "" }, [RSPAMD_STAT_BACKEND_GET_TOKEN] = { @@ -166,6 +171,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .stmt = NULL, .args = "III", .result = SQLITE_ROW, + .flags = 0, .ret = "I" }, [RSPAMD_STAT_BACKEND_SET_TOKEN] = { @@ -175,6 +181,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .stmt = NULL, .args = "IIII", .result = SQLITE_DONE, + .flags = 0, .ret = "" }, [RSPAMD_STAT_BACKEND_INC_LEARNS] = { @@ -184,6 +191,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .stmt = NULL, .args = "II", .result = SQLITE_DONE, + .flags = 0, .ret = "" }, [RSPAMD_STAT_BACKEND_DEC_LEARNS] = { @@ -193,6 +201,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .stmt = NULL, .args = "II", .result = SQLITE_DONE, + .flags = 0, .ret = "" }, [RSPAMD_STAT_BACKEND_GET_LEARNS] = { @@ -201,6 +210,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .stmt = NULL, .args = "", .result = SQLITE_ROW, + .flags = 0, .ret = "I" }, [RSPAMD_STAT_BACKEND_GET_LANGUAGE] = { @@ -209,6 +219,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .stmt = NULL, .args = "T", .result = SQLITE_ROW, + .flags = 0, .ret = "I" }, [RSPAMD_STAT_BACKEND_GET_USER] = { @@ -217,6 +228,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .stmt = NULL, .args = "T", .result = SQLITE_ROW, + .flags = 0, .ret = "I" }, [RSPAMD_STAT_BACKEND_INSERT_USER] = { @@ -225,6 +237,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .stmt = NULL, .args = "T", .result = SQLITE_DONE, + .flags = 0, .ret = "L" }, [RSPAMD_STAT_BACKEND_INSERT_LANGUAGE] = { @@ -233,6 +246,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .stmt = NULL, .args = "T", .result = SQLITE_DONE, + .flags = 0, .ret = "L" }, [RSPAMD_STAT_BACKEND_SAVE_TOKENIZER] = { @@ -241,6 +255,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .stmt = NULL, .args = "B", .result = SQLITE_DONE, + .flags = 0, .ret = "" }, [RSPAMD_STAT_BACKEND_LOAD_TOKENIZER] = { @@ -249,6 +264,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .stmt = NULL, .args = "", .result = SQLITE_ROW, + .flags = 0, .ret = "B" }, [RSPAMD_STAT_BACKEND_NTOKENS] = { @@ -257,6 +273,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .stmt = NULL, .args = "", .result = SQLITE_ROW, + .flags = 0, .ret = "I" }, [RSPAMD_STAT_BACKEND_NLANGUAGES] = { @@ -265,6 +282,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .stmt = NULL, .args = "", .result = SQLITE_ROW, + .flags = 0, .ret = "I" }, [RSPAMD_STAT_BACKEND_NUSERS] = { @@ -273,6 +291,7 @@ static struct rspamd_sqlite3_prstmt prepared_stmts[RSPAMD_STAT_BACKEND_MAX] = .stmt = NULL, .args = "", .result = SQLITE_ROW, + .flags = 0, .ret = "I" } }; diff --git a/src/libutil/sqlite_utils.c b/src/libutil/sqlite_utils.c index fd7287c7f..e1e6f7f76 100644 --- a/src/libutil/sqlite_utils.c +++ b/src/libutil/sqlite_utils.c @@ -172,6 +172,7 @@ rspamd_sqlite3_run_prstmt (rspamd_mempool_t *pool, sqlite3 *db, GArray *stmts, } if (!(nst->flags & RSPAMD_SQLITE3_STMT_MULTIPLE)) { + sqlite3_clear_bindings (stmt); sqlite3_reset (stmt); } @@ -183,6 +184,7 @@ rspamd_sqlite3_run_prstmt (rspamd_mempool_t *pool, sqlite3 *db, GArray *stmts, } if (!(nst->flags & RSPAMD_SQLITE3_STMT_MULTIPLE)) { + sqlite3_clear_bindings (stmt); sqlite3_reset (stmt); } |