Mercurial > dedupe
comparison TestDataBase.cpp @ 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 | TestDatabase.cpp@8136057988bc |
| children |
comparison
equal
deleted
inserted
replaced
| 76:8136057988bc | 77:a827f3687c4a |
|---|---|
| 1 #include "TestDataBase.hpp" | |
| 2 | |
| 3 #include "Exception/IOException.hpp" | |
| 4 | |
| 5 TestDatabase::TestDatabase() : connectionName("TestDatabase"), | |
| 6 db(new QSqlDatabase) | |
| 7 { | |
| 8 *db = QSqlDatabase::addDatabase("QSQLITE", connectionName); | |
| 9 const QString dbPath(":memory:"); | |
| 10 db->setDatabaseName(dbPath); | |
| 11 if (!db->open()) | |
| 12 throw | |
| 13 IOException(QString("Unable to open SQLite database with path '%1'") | |
| 14 .arg(dbPath)); | |
| 15 | |
| 16 } | |
| 17 | |
| 18 TestDatabase::~TestDatabase() | |
| 19 { | |
| 20 db->close(); | |
| 21 delete db; | |
| 22 QSqlDatabase::removeDatabase(connectionName); | |
| 23 } | |
| 24 | |
| 25 QSqlDatabase TestDatabase::getDatabase() | |
| 26 { | |
| 27 return *db; | |
| 28 } |
