comparison SqliteDBLink.cpp @ 7:d6fdca3bf24e

Make sure everything works for MemoryDBLink.
author Tom Fredrik Blenning Klaussen <bfg@blenning.no>
date Wed, 22 Aug 2012 01:07:06 +0200
parents 5e4985407feb
children b5943e4bf676
comparison
equal deleted inserted replaced
6:7ebdd2373ea4 7:d6fdca3bf24e
66 void SqliteDBLink::addFile(const QString& path, qint64 size, const QDateTime& dtime, const QByteArray& hash) 66 void SqliteDBLink::addFile(const QString& path, qint64 size, const QDateTime& dtime, const QByteArray& hash)
67 { 67 {
68 addFile(DBInfo(path, size, dtime, hash)); 68 addFile(DBInfo(path, size, dtime, hash));
69 } 69 }
70 70
71 void SqliteDBLink::updateFile(const QString& path, qint64 size, const QDateTime& dtime, const QByteArray& hash)
72 {
73 updateFile(DBInfo(path, size, dtime, hash));
74 }
75
76 bool SqliteDBLink::tryAddFile(const DBInfo& dbinfo) 71 bool SqliteDBLink::tryAddFile(const DBInfo& dbinfo)
77 { 72 {
78 if (exists(dbinfo.path())) 73 if (exists(dbinfo.path()))
79 return false; 74 return false;
80 QSqlQuery query; 75 QSqlQuery query;
86 query.bindValue(":checksum", dbinfo.checksum()); 81 query.bindValue(":checksum", dbinfo.checksum());
87 if (!query.exec()) { 82 if (!query.exec()) {
88 qDebug() << dbinfo.path() << "::" << query.lastQuery() << "::" << query.lastError().text(); 83 qDebug() << dbinfo.path() << "::" << query.lastQuery() << "::" << query.lastError().text();
89 } 84 }
90 return true; 85 return true;
86 }
87
88 void SqliteDBLink::updateFile(const QString& path, qint64 size, const QDateTime& dtime, const QByteArray& hash)
89 {
90 updateFile(DBInfo(path, size, dtime, hash));
91 } 91 }
92 92
93 void SqliteDBLink::updateFile(const DBInfo& dbinfo) 93 void SqliteDBLink::updateFile(const DBInfo& dbinfo)
94 { 94 {
95 QSqlQuery query; 95 QSqlQuery query;