aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-09-28 10:40:43 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-09-28 10:40:43 +0100
commit762aeb28d3086386baf6b87bf8fb35198757aeec (patch)
tree6261e503616a4af3bb126b3904baca4ef4623871 /src/libserver
parentc698e465d766a9c48014150ebb96a7f92aee7cca (diff)
downloadrspamd-762aeb28d3086386baf6b87bf8fb35198757aeec.tar.gz
rspamd-762aeb28d3086386baf6b87bf8fb35198757aeec.zip
Enable foreign keys in sqlite3.
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/fuzzy_backend.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libserver/fuzzy_backend.c b/src/libserver/fuzzy_backend.c
index ce6bd6a5a..016ee2b5a 100644
--- a/src/libserver/fuzzy_backend.c
+++ b/src/libserver/fuzzy_backend.c
@@ -408,7 +408,8 @@ rspamd_fuzzy_backend_open (const gchar *path, GError **err)
gint fd;
struct rspamd_fuzzy_backend *backend;
static const char sqlite_wal[] = "PRAGMA journal_mode=\"wal\";",
- fallback_journal[] = "PRAGMA journal_mode=\"off\";";
+ fallback_journal[] = "PRAGMA journal_mode=\"off\";",
+ foreign_keys[] = "PRAGMA foreign_keys=\"ON\";";
int rc;
if (path == NULL) {
@@ -466,6 +467,11 @@ rspamd_fuzzy_backend_open (const gchar *path, GError **err)
sqlite3_exec (backend->db, fallback_journal, NULL, NULL, NULL);
}
+ if ((rc = sqlite3_exec (backend->db, foreign_keys, NULL, NULL, NULL)) !=
+ SQLITE_OK) {
+ msg_warn_fuzzy_backend ("foreign keys are not supported", rc);
+ }
+
/* Cleanup database */
rspamd_fuzzy_backend_run_simple (RSPAMD_FUZZY_BACKEND_VACUUM, backend, NULL);