comparison DBCache.hpp @ 34:fda70a362ed5

Remove whitespace.
author Tom Fredrik Blenning Klaussen <bfg@blenning.no>
date Thu, 06 Sep 2012 21:33:24 +0200
parents c978d4a6514d
children 2b83559b78db
comparison
equal deleted inserted replaced
33:44a3c32dd0cb 34:fda70a362ed5
196 } 196 }
197 197
198 static QString restriction(const QString& prefix = QString()) 198 static QString restriction(const QString& prefix = QString())
199 { 199 {
200 return SQLGenerator<T>::restrict(prefix + "_1") + " AND " + 200 return SQLGenerator<T>::restrict(prefix + "_1") + " AND " +
201 SQLGenerator<T>::restrict(prefix + "_2"); 201 SQLGenerator<T>::restrict(prefix + "_2");
202 } 202 }
203 203
204 static QString valueString(const QString &prefix = QString()) 204 static QString valueString(const QString &prefix = QString())
205 { 205 {
206 return SQLGenerator<T>::valueString(prefix + "_1") + ", " + 206 return SQLGenerator<T>::valueString(prefix + "_1") + ", " +
295 insertQuery.finish(); 295 insertQuery.finish();
296 unsyncedKeys.clear(); 296 unsyncedKeys.clear();
297 } 297 }
298 298
299 public: 299 public:
300 DBCache(const QString& dbName, const QString& dictName) 300 DBCache(const QString& dbName, const QString& dictName)
301 { 301 {
302 db = QSqlDatabase::addDatabase("QSQLITE", "dictName"); 302 db = QSqlDatabase::addDatabase("QSQLITE", "dictName");
303 db.setDatabaseName(dbName); 303 db.setDatabaseName(dbName);
304 if (!db.open()) 304 if (!db.open())
305 throw IOException(QString("Unable to open SQLite database with path '%1'").arg(dictName)); 305 throw IOException(QString("Unable to open SQLite database with path '%1'").arg(dictName));
306 setup(db, dictName); 306 setup(db, dictName);
307 } 307 }
308 308
309 DBCache(const QSqlDatabase& db, const QString& dictName) 309 DBCache(const QSqlDatabase& db, const QString& dictName)
310 { 310 {
311 setup(db, dictName); 311 setup(db, dictName);
312 } 312 }
313 313
314 boost::optional<Value> value(const Key& key) const 314 boost::optional<Value> value(const Key& key) const
347 if (!insertQuery.exec()) { 347 if (!insertQuery.exec()) {
348 throw SQLException(insertQuery); 348 throw SQLException(insertQuery);
349 } 349 }
350 insertQuery.finish(); 350 insertQuery.finish();
351 } 351 }
352 352
353 } 353 }
354 354
355 private: 355 private:
356 QSqlDatabase db; 356 QSqlDatabase db;
357 QString dictName; 357 QString dictName;