From 6dd746005c921dc2c49bf19a3524ea3bfb5e2d30 Mon Sep 17 00:00:00 2001 From: methodus Date: Sun, 28 Oct 2012 20:16:19 +0100 Subject: Added database wrapper replacement for tntdb. Added a test_programm to verify its functionality. --- tests/Makefile | 8 +++++--- tests/test_database.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 tests/test_database.cpp (limited to 'tests') diff --git a/tests/Makefile b/tests/Makefile index c8e6192..35914be 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,6 +1,8 @@ - parser: test_parser.cpp ../common/parser.cpp g++ -o test_parser test_parser.cpp ../common/parser.cpp -g -I../include -I/usr/include -I/usr/local/include - + dllloader: dll_loader.cpp ../media/pluginManager.cpp ../common/tools.cpp - g++ -o test_dllloader dll_loader.cpp ../media/pluginManager.cpp ../common/tools.cpp -g -ldl -Wl,--export-dynamic -I../include -I/usr/include -I/usr/local/include \ No newline at end of file + g++ -o test_dllloader dll_loader.cpp ../media/pluginManager.cpp ../common/tools.cpp -g -ldl -Wl,--export-dynamic -I../include -I/usr/include -I/usr/local/include + +database: test_database.cpp + g++ -o test_database test_database.cpp -g -lsqlite3 -I../include -I/usr/include -I/usr/local/include \ No newline at end of file diff --git a/tests/test_database.cpp b/tests/test_database.cpp new file mode 100644 index 0000000..da11cb9 --- /dev/null +++ b/tests/test_database.cpp @@ -0,0 +1,25 @@ +/* + * test_database.cpp + * + * Created on: 28.10.2012 + * Author: savop + */ + +#include +#include "../include/db/connection.h" + +int main(){ + + try { + db::Connection connection = db::Connect("/tmp/test_db.sqlite"); + + connection.BeginTransaction(); + + connection.RollbackTransaction(); + + } catch (const db::SQLiteException& e){ + std::cerr << "Exception: "<< e.what() << std::endl; + } + + return 0; +} -- cgit v1.2.3