Mercurial > dedupe
diff DBCache.hpp @ 31:bf3dce7fedcb
Remove all references to QDebug
| author | Tom Fredrik Blenning Klaussen <bfg@blenning.no> |
|---|---|
| date | Thu, 06 Sep 2012 19:14:58 +0200 |
| parents | 5d14d8c2c299 |
| children | c978d4a6514d |
line wrap: on
line diff
--- a/DBCache.hpp Thu Sep 06 18:39:01 2012 +0200 +++ b/DBCache.hpp Thu Sep 06 19:14:58 2012 +0200 @@ -6,8 +6,9 @@ #include <QtSql/QSqlError> #include <QtSql/QSqlRecord> -#include <QtCore/QDebug> + #include <QtCore/QStringList> +#include <QtCore/QVariant> #include <cassert> #include "OrderedPair.hpp" @@ -15,6 +16,7 @@ #include "ThreadSafeLookup.hpp" #include "UniqueString.hpp" +#include "Exception/SQLException.hpp" template<typename T> @@ -253,8 +255,7 @@ query.exec(createQuery); } if (!db.tables().contains(dictName)) { - qDebug()<<"No database"; - exit(1); + throw SQLException("No databaase"); } if (memoryMapped) { QString keyFields = SQLGenerator<Key>::fieldName("key"); @@ -262,7 +263,7 @@ QString repopulateQuery = QString("SELECT %1, %2 FROM %3;").arg(keyFields).arg(valueFields).arg(dictName); QSqlQuery query(db); if (!query.exec(repopulateQuery)) { - qDebug() << query.lastError() << repopulateQuery; + throw SQLException(query); } while (query.next()) { Key key = *SQLGenerator<Key>::extract(query, "key"); @@ -289,7 +290,7 @@ } SQLGenerator<Value>::bindValues(insertQuery, values, "value"); if (!insertQuery.exec()) { - qDebug() << insertQuery.lastError() << insertQuery.lastQuery(); + throw SQLException(insertQuery); } insertQuery.finish(); unsyncedKeys.clear(); @@ -324,7 +325,7 @@ query.prepare(queryString); SQLGenerator<Key>::bindValue(query, key, "key"); if (!query.exec()) { - qDebug() << query.lastError() << queryString; + throw SQLException(query); } query.next(); return SQLGenerator<Value>::extract(query, "value"); @@ -344,7 +345,7 @@ SQLGenerator<Key>::bindValue(insertQuery, key, "key"); SQLGenerator<Value>::bindValue(insertQuery, value, "value"); if (!insertQuery.exec()) { - qDebug() << insertQuery.lastError() << insertQuery.lastQuery(); + throw SQLException(insertQuery); } insertQuery.finish(); }
