Mercurial > dedupe
diff SqliteDBLink.hpp @ 93:308a718812ba
Small refactoring to allow lazy commits.
| author | Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no> |
|---|---|
| date | Tue, 22 Oct 2013 11:53:54 +0200 |
| parents | f49023c61dac |
| children | 93981e675d67 |
line wrap: on
line diff
--- a/SqliteDBLink.hpp Mon Oct 21 20:03:39 2013 +0200 +++ b/SqliteDBLink.hpp Tue Oct 22 11:53:54 2013 +0200 @@ -3,6 +3,7 @@ #include "FileDBLink.hpp" #include <QtSql/QSqlDatabase> +#include <QtCore/QPair> class SqliteDBLink : public FileDBLink { public: @@ -26,11 +27,15 @@ virtual void keepOnlyFromPrefix(const QString& prefix, const QStringList& files); virtual void deleteFileFromDB(const QString& path); + bool commit(); private: - void addFile(const DBInfo& info, bool lazy); + typedef enum {Add, Update } OperationType; + typedef QPair<DBInfo, OperationType> Operation; + + void addFile(const DBInfo& info, bool lazy = false); bool tryAddFile(const DBInfo& info); - void updateFile(const DBInfo& dbinfo, bool lazy); + void updateFile(const DBInfo& dbinfo, bool lazy = false); QSqlDatabase db; static const QString connectionName; @@ -38,6 +43,7 @@ QSqlQuery* preparedSizePrefixQuery; QSqlQuery* preparedSizeQuery; QSqlQuery* preparedTryAddQuery; + QList<Operation> operations; }; #endif //MEMORYDBLINK_HPP
