# HG changeset patch # User Tom Fredrik Blenning Klaussen # Date 1361037654 -3600 # Node ID a827f3687c4a34a539bc3e1411e0acb03abcd761 # Parent 8136057988bcca5bebe3967535e79145a99fcee6 Compile fix Linux, wrong capitalization. diff -r 8136057988bc -r a827f3687c4a CMakeLists.txt --- a/CMakeLists.txt Sat Feb 16 15:32:20 2013 +0100 +++ b/CMakeLists.txt Sat Feb 16 19:00:54 2013 +0100 @@ -117,7 +117,7 @@ SET(TEST_SOURCES ${CLASS_SOURCES} ${MOC_SOURCES} - TestDatabase.cpp + TestDataBase.cpp TestFramework.cpp ) diff -r 8136057988bc -r a827f3687c4a TestDataBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TestDataBase.cpp Sat Feb 16 19:00:54 2013 +0100 @@ -0,0 +1,28 @@ +#include "TestDataBase.hpp" + +#include "Exception/IOException.hpp" + +TestDatabase::TestDatabase() : connectionName("TestDatabase"), + db(new QSqlDatabase) +{ + *db = QSqlDatabase::addDatabase("QSQLITE", connectionName); + const QString dbPath(":memory:"); + db->setDatabaseName(dbPath); + if (!db->open()) + throw + IOException(QString("Unable to open SQLite database with path '%1'") + .arg(dbPath)); + +} + +TestDatabase::~TestDatabase() +{ + db->close(); + delete db; + QSqlDatabase::removeDatabase(connectionName); +} + +QSqlDatabase TestDatabase::getDatabase() +{ + return *db; +} diff -r 8136057988bc -r a827f3687c4a TestDataBase.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TestDataBase.hpp Sat Feb 16 19:00:54 2013 +0100 @@ -0,0 +1,18 @@ +#ifndef TESTDATABASE_HPP +#define TESTDATABASE_HPP + +#include + +class TestDatabase +{ +public: + QSqlDatabase getDatabase(); + TestDatabase(); + ~TestDatabase(); + +private: + const QString connectionName; + QSqlDatabase *db; +}; + +#endif //TESTDATABASE_HPP diff -r 8136057988bc -r a827f3687c4a TestDatabase.cpp --- a/TestDatabase.cpp Sat Feb 16 15:32:20 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -#include "TestDataBase.hpp" - -#include "Exception/IOException.hpp" - -TestDatabase::TestDatabase() : connectionName("TestDatabase"), - db(new QSqlDatabase) -{ - *db = QSqlDatabase::addDatabase("QSQLITE", connectionName); - const QString dbPath(":memory:"); - db->setDatabaseName(dbPath); - if (!db->open()) - throw - IOException(QString("Unable to open SQLite database with path '%1'") - .arg(dbPath)); - -} - -TestDatabase::~TestDatabase() -{ - db->close(); - delete db; - QSqlDatabase::removeDatabase(connectionName); -} - -QSqlDatabase TestDatabase::getDatabase() -{ - return *db; -} diff -r 8136057988bc -r a827f3687c4a TestDatabase.hpp --- a/TestDatabase.hpp Sat Feb 16 15:32:20 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -#ifndef TESTDATABASE_HPP -#define TESTDATABASE_HPP - -#include - -class TestDatabase -{ -public: - QSqlDatabase getDatabase(); - TestDatabase(); - ~TestDatabase(); - -private: - const QString connectionName; - QSqlDatabase *db; -}; - -#endif //TESTDATABASE_HPP