From b326bca552d7c1d67f8cc431ff200537923889fe Mon Sep 17 00:00:00 2001 From: HanzZ Date: Sun, 8 Apr 2012 13:53:14 +0200 Subject: [PATCH] set sqlite3 as default backend --- include/transport/protocol.proto | 6 ++++++ src/storagebackend.cpp | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/transport/protocol.proto b/include/transport/protocol.proto index 8f3ac42c..8dddaf7e 100644 --- a/include/transport/protocol.proto +++ b/include/transport/protocol.proto @@ -44,6 +44,7 @@ message Login { required string user = 1; required string legacyName = 2; required string password = 3; + repeated string extraFields = 4; } message Logout { @@ -122,6 +123,10 @@ message FileTransferData { required bytes data = 2; } +message BackendConfig { + required string config = 1; +} + message WrapperMessage { enum Type { TYPE_CONNECTED = 1; @@ -152,6 +157,7 @@ message WrapperMessage { TYPE_FT_PAUSE = 27; TYPE_FT_CONTINUE = 28; TYPE_EXIT = 29; + TYPE_BACKEND_CONFIG = 30; } required Type type = 1; optional bytes payload = 2; diff --git a/src/storagebackend.cpp b/src/storagebackend.cpp index 17657a48..fabaed47 100644 --- a/src/storagebackend.cpp +++ b/src/storagebackend.cpp @@ -10,7 +10,8 @@ namespace Transport { StorageBackend *StorageBackend::createBackend(Config *config, std::string &error) { StorageBackend *storageBackend = NULL; #ifdef WITH_SQLITE - if (CONFIG_STRING(config, "database.type") == "sqlite3") { + if (CONFIG_STRING(config, "database.type") == "sqlite3" || + (CONFIG_STRING(config, "database.type") == "none" && CONFIG_BOOL(config, "service.server_mode"))) { storageBackend = new SQLite3Backend(config); } #else @@ -43,6 +44,7 @@ StorageBackend *StorageBackend::createBackend(Config *config, std::string &error && CONFIG_STRING(config, "database.type") != "pqxx" && CONFIG_STRING(config, "database.type") != "none") { error = "Unknown storage backend " + CONFIG_STRING(config, "database.type"); } + return storageBackend; }