From f678526b2089826fba0299c88b9258bc48f748c4 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 2 Nov 2011 17:49:09 +0300 Subject: * Implement sqlite3 backend for kvstorage. --- src/kvstorage_config.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/kvstorage_config.c') diff --git a/src/kvstorage_config.c b/src/kvstorage_config.c index 0dbad5380..57a23d6ab 100644 --- a/src/kvstorage_config.c +++ b/src/kvstorage_config.c @@ -27,6 +27,9 @@ #ifdef WITH_DB #include "kvstorage_bdb.h" #endif +#ifdef WITH_SQLITE +#include "kvstorage_sqlite.h" +#endif #define LRU_QUEUES 32 @@ -93,12 +96,18 @@ kvstorage_init_callback (const gpointer key, const gpointer value, gpointer unus switch (kconf->backend.type) { case KVSTORAGE_TYPE_BACKEND_NULL: + case KVSTORAGE_TYPE_BACKEND_MAX: backend = NULL; break; #ifdef WITH_DB case KVSTORAGE_TYPE_BACKEND_BDB: backend = rspamd_kv_bdb_new (kconf->backend.filename, kconf->backend.sync_ops); break; +#endif +#ifdef WITH_SQLITE + case KVSTORAGE_TYPE_BACKEND_SQLITE: + backend = rspamd_kv_sqlite_new (kconf->backend.filename, kconf->backend.sync_ops); + break; #endif } @@ -366,6 +375,11 @@ void kvstorage_xml_text (GMarkupParseContext *context, else if (g_ascii_strncasecmp (text, "bdb", MIN (text_len, sizeof ("bdb") - 1)) == 0) { kv_parser->current_storage->backend.type = KVSTORAGE_TYPE_BACKEND_BDB; } +#endif +#ifdef WITH_SQLITE + else if (g_ascii_strncasecmp (text, "sqlite", MIN (text_len, sizeof ("sqlite") - 1)) == 0) { + kv_parser->current_storage->backend.type = KVSTORAGE_TYPE_BACKEND_SQLITE; + } #endif else { if (*error == NULL) { -- cgit v1.2.3