Mercurial > dedupe
diff SqliteDBLink.cpp @ 92:f49023c61dac
Support for bulk insertion.
| author | Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no> |
|---|---|
| date | Mon, 21 Oct 2013 20:03:39 +0200 |
| parents | 7b7a959c993b |
| children | 308a718812ba |
line wrap: on
line diff
--- a/SqliteDBLink.cpp Mon Oct 21 16:21:54 2013 +0200 +++ b/SqliteDBLink.cpp Mon Oct 21 20:03:39 2013 +0200 @@ -85,9 +85,10 @@ } void SqliteDBLink::addFile(const QString& path, quint64 size, - const QDateTime& dtime, const QByteArray& hash) + const QDateTime& dtime, const QByteArray& hash, + bool lazy) { - addFile(DBInfo(path, size, dtime, hash)); + addFile(DBInfo(path, size, dtime, hash), lazy); } bool SqliteDBLink::tryAddFile(const DBInfo& dbinfo) @@ -106,12 +107,12 @@ void SqliteDBLink::updateFile(const QString& path, quint64 size, const QDateTime& dtime, - const QByteArray& hash) + const QByteArray& hash, bool lazy) { - updateFile(DBInfo(path, size, dtime, hash)); + updateFile(DBInfo(path, size, dtime, hash), lazy); } -void SqliteDBLink::updateFile(const DBInfo& dbinfo) +void SqliteDBLink::updateFile(const DBInfo& dbinfo, bool lazy) { QSqlQuery query(db); query.prepare("UPDATE files " @@ -126,7 +127,7 @@ } } -void SqliteDBLink::addFile(const DBInfo& dbinfo) +void SqliteDBLink::addFile(const DBInfo& dbinfo, bool lazy) { if (!tryAddFile(dbinfo)) { abort(); //Should throw exception
