Mercurial > dedupe
changeset 77:a827f3687c4a
Compile fix Linux, wrong capitalization.
| author | Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no> |
|---|---|
| date | Sat, 16 Feb 2013 19:00:54 +0100 |
| parents | 8136057988bc |
| children | 9744ec195be3 |
| files | CMakeLists.txt TestDataBase.cpp TestDataBase.hpp TestDatabase.cpp TestDatabase.hpp |
| diffstat | 5 files changed, 47 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- 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 )
--- /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; +}
--- /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 <QtSql/QSqlDatabase> + +class TestDatabase +{ +public: + QSqlDatabase getDatabase(); + TestDatabase(); + ~TestDatabase(); + +private: + const QString connectionName; + QSqlDatabase *db; +}; + +#endif //TESTDATABASE_HPP
--- 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; -}
--- 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 <QtSql/QSqlDatabase> - -class TestDatabase -{ -public: - QSqlDatabase getDatabase(); - TestDatabase(); - ~TestDatabase(); - -private: - const QString connectionName; - QSqlDatabase *db; -}; - -#endif //TESTDATABASE_HPP
