#include"transport/storagebackend.h"#include"transport/config.h"#include"transport/sqlite3backend.h"#include"transport/mysqlbackend.h"#include"transport/pqxxbackend.h"namespaceTransport{StorageBackend*StorageBackend::createBackend(Config*config,std::string&error){StorageBackend*storageBackend=NULL;#ifdef WITH_SQLITEif(CONFIG_STRING(config,"database.type")=="sqlite3"||(CONFIG_STRING(config,"database.type")=="none"&&!CONFIG_BOOL(config,"service.server_mode"))){storageBackend=newSQLite3Backend(config);}#elseif(CONFIG_STRING(config,"database.type")=="sqlite3"){error="Libtransport is not compiled with sqlite3 backend support.";}#endif#ifdef WITH_MYSQLif(CONFIG_STRING(config,"database.type")=="mysql"){storageBackend=newMySQLBackend(config);}#elseif(CONFIG_STRING(config,"database.type")=="mysql"){error="Spectrum2 is not compiled with mysql backend support.";}#endif#ifdef WITH_PQXXif(CONFIG_STRING(config,"database.type")=="pqxx"){storageBackend=newPQXXBackend(config);}#elseif(CONFIG_STRING(config,"database.type")=="pqxx"){error="Spectrum2 is not compiled with pqxx backend support.";}#endifif(CONFIG_STRING(config,"database.type")!="mysql"&&CONFIG_STRING(config,"database.type")!="sqlite3"&&CONFIG_STRING(config,"database.type")!="pqxx"&&CONFIG_STRING(config,"database.type")!="none"){error="Unknown storage backend "+CONFIG_STRING(config,"database.type");}returnstorageBackend;}}