Allow compilation without sqlite/mysql

This commit is contained in:
Jan Kaluza 2011-09-07 14:19:10 +02:00
parent 7e87208497
commit 7664202b38
5 changed files with 22 additions and 3 deletions

View file

@ -20,6 +20,8 @@
#pragma once
#ifdef WITH_MYSQL
#include <string>
#include <map>
#include "Swiften/Swiften.h"
@ -147,3 +149,5 @@ class MySQLBackend : public StorageBackend
};
}
#endif

View file

@ -20,6 +20,8 @@
#pragma once
#ifdef WITH_SQLITE
#include <string>
#include <map>
#include "Swiften/Swiften.h"
@ -115,3 +117,5 @@ class SQLite3Backend : public StorageBackend
};
}
#endif

View file

@ -107,6 +107,7 @@ int main(int argc, char **argv)
StorageBackend *storageBackend = NULL;
#ifdef WITH_SQLITE
if (CONFIG_STRING(&config, "database.type") == "sqlite3") {
storageBackend = new SQLite3Backend(&config);
if (!storageBackend->connect()) {
@ -114,15 +115,17 @@ int main(int argc, char **argv)
return -1;
}
}
/*
else if (CONFIG_STRING(&config, "database.type") == "mysql") {
#endif
#ifdef WITH_MYSQL
if (CONFIG_STRING(&config, "database.type") == "mysql") {
storageBackend = new MySQLBackend(&config);
if (!storageBackend->connect()) {
std::cerr << "Can't connect to database.\n";
return -1;
}
}
*/
#endif
UserManager userManager(&transport, &userRegistry, storageBackend);
UserRegistration *userRegistration = NULL;
if (storageBackend) {

View file

@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#ifdef WITH_MYSQL
#include "transport/mysqlbackend.h"
#include <boost/bind.hpp>
#include "log4cxx/logger.h"
@ -468,3 +470,5 @@ void MySQLBackend::commitTransaction() {
}
}
#endif

View file

@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#ifdef WITH_SQLITE
#include "transport/sqlite3backend.h"
#include <boost/bind.hpp>
#include "log4cxx/logger.h"
@ -434,3 +436,5 @@ void SQLite3Backend::commitTransaction() {
}
}
#endif