comparison FileDBLink.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 a5788991ca9f
children 308a718812ba
comparison
equal deleted inserted replaced
91:a5788991ca9f 92:f49023c61dac
5 #include "Exception/PermissionException.hpp" 5 #include "Exception/PermissionException.hpp"
6 6
7 #include <QtCore/QtConcurrentMap> 7 #include <QtCore/QtConcurrentMap>
8 8
9 #include <boost/bind.hpp> 9 #include <boost/bind.hpp>
10
11 FileDBLink::~FileDBLink()
12 {
13 commit();
14 }
10 15
11 void FileDBLink::updateIfModified(const QString& path, bool lazy) 16 void FileDBLink::updateIfModified(const QString& path, bool lazy)
12 { 17 {
13 QFileInfo fileinfo(path); 18 QFileInfo fileinfo(path);
14 FileDBLink::DBStatus status = existsWithMtime(path, fileinfo.lastModified()); 19 FileDBLink::DBStatus status = existsWithMtime(path, fileinfo.lastModified());
28 33
29 void FileDBLink::addFile(const QString& path, quint64 size, 34 void FileDBLink::addFile(const QString& path, quint64 size,
30 const QDateTime& lastModified, bool lazy) 35 const QDateTime& lastModified, bool lazy)
31 { 36 {
32 QByteArray hash; 37 QByteArray hash;
33 //if (!lazy || updateAllWithSize(size))
34 if (!lazy) 38 if (!lazy)
35 hash = computeHash(path); 39 hash = computeHash(path);
36 addFile(path, size, lastModified, hash); 40 addFile(path, size, lastModified, hash, lazy);
37 } 41 }
38 42
39 void FileDBLink::addFile(const QFileInfo& fileinfo, bool lazy) 43 void FileDBLink::addFile(const QFileInfo& fileinfo, bool lazy)
40 { 44 {
41 addFile(fileinfo.absoluteFilePath(), fileinfo.size(), 45 addFile(fileinfo.absoluteFilePath(), fileinfo.size(),
89 93
90 void FileDBLink::updateFile(const QString& path, quint64 size, 94 void FileDBLink::updateFile(const QString& path, quint64 size,
91 const QDateTime& lastModified, bool lazy) 95 const QDateTime& lastModified, bool lazy)
92 { 96 {
93 QByteArray hash; 97 QByteArray hash;
94 //if (!lazy || updateAllWithSize(size))
95 if (!lazy) 98 if (!lazy)
96 hash = computeHash(path); 99 hash = computeHash(path);
97 updateFile(path, size, lastModified, hash); 100 updateFile(path, size, lastModified, hash);
98 } 101 }
99 102
219 return val; 222 return val;
220 } 223 }
221 } 224 }
222 return dbinf_ptr_t(); 225 return dbinf_ptr_t();
223 } 226 }
227
228 bool FileDBLink::commit()
229 {
230 return true;
231 }