Changeset - 7664202b38dc
[Not reviewed]
0 5 0
Jan Kaluza - 14 years ago 2011-09-07 14:19:10
hanzz.k@gmail.com
Allow compilation without sqlite/mysql
5 files changed with 22 insertions and 3 deletions:
0 comments (0 inline, 0 general)
include/transport/mysqlbackend.h
Show inline comments
 
@@ -17,12 +17,14 @@
 
 * along with this program; if not, write to the Free Software
 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
 
 */
 

	
 
#pragma once
 

	
 
#ifdef WITH_MYSQL
 

	
 
#include <string>
 
#include <map>
 
#include "Swiften/Swiften.h"
 
#include "transport/storagebackend.h"
 
#include "transport/config.h"
 
#include "mysql.h"
 
@@ -144,6 +146,8 @@ class MySQLBackend : public StorageBackend
 
		Statement *m_updateBuddySetting;
 
		MYSQL_STMT *m_getBuddies;
 
		MYSQL_STMT *m_getBuddiesSettings;
 
};
 

	
 
}
 

	
 
#endif
include/transport/sqlite3backend.h
Show inline comments
 
@@ -17,12 +17,14 @@
 
 * along with this program; if not, write to the Free Software
 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
 
 */
 

	
 
#pragma once
 

	
 
#ifdef WITH_SQLITE
 

	
 
#include <string>
 
#include <map>
 
#include "Swiften/Swiften.h"
 
#include "transport/storagebackend.h"
 
#include "transport/config.h"
 
#include "sqlite3.h"
 
@@ -112,6 +114,8 @@ class SQLite3Backend : public StorageBackend
 
		sqlite3_stmt *m_updateBuddySetting;
 
		sqlite3_stmt *m_getBuddies;
 
		sqlite3_stmt *m_getBuddiesSettings;
 
};
 

	
 
}
 

	
 
#endif
spectrum/src/main.cpp
Show inline comments
 
@@ -104,28 +104,31 @@ int main(int argc, char **argv)
 
 
	Component transport(&eventLoop, factories, &config, NULL, &userRegistry);
 
// 	Logger logger(&transport);
 
 
	StorageBackend *storageBackend = NULL;
 
 
#ifdef WITH_SQLITE
 
	if (CONFIG_STRING(&config, "database.type") == "sqlite3") {
 
		storageBackend = new SQLite3Backend(&config);
 
		if (!storageBackend->connect()) {
 
			std::cerr << "Can't connect to database.\n";
 
			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) {
 
		userRegistration = new UserRegistration(&transport, &userManager, storageBackend);
 
		userRegistration->start();
 
// 		logger.setUserRegistration(&userRegistration);
src/mysqlbackend.cpp
Show inline comments
 
@@ -15,12 +15,14 @@
 
 *
 
 * You should have received a copy of the GNU General Public License
 
 * along with this program; if not, write to the Free Software
 
 * 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"
 

	
 
using namespace log4cxx;
 

	
 
@@ -465,6 +467,8 @@ void MySQLBackend::beginTransaction() {
 

	
 
void MySQLBackend::commitTransaction() {
 
	exec("COMMIT;");
 
}
 

	
 
}
 

	
 
#endif
src/sqlite3backend.cpp
Show inline comments
 
@@ -15,12 +15,14 @@
 
 *
 
 * You should have received a copy of the GNU General Public License
 
 * along with this program; if not, write to the Free Software
 
 * 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"
 

	
 
using namespace log4cxx;
 

	
 
@@ -431,6 +433,8 @@ void SQLite3Backend::beginTransaction() {
 

	
 
void SQLite3Backend::commitTransaction() {
 
	exec("COMMIT TRANSACTION;");
 
}
 

	
 
}
 

	
 
#endif
0 comments (0 inline, 0 general)