bindValueInternal(pos, value);
}
+ void bindValue(int pos, const QByteArray &value)
+ {
+ qCDebug(lcSql) << "SQL bind" << pos << QString::fromUtf8(value);
+ bindValueInternal(pos, value);
+ }
+
const QByteArray &lastQuery() const;
int numRowsAffected();
void reset_and_clear_bindings();
}
}
- qCInfo(lcDb) << "Updating file record for path:" << record._path << "inode:" << record._inode
+ qCInfo(lcDb) << "Updating file record for path:" << record.path() << "inode:" << record._inode
<< "modtime:" << record._modtime << "type:" << record._type
<< "etag:" << record._etag << "fileId:" << record._fileId << "remotePerm:" << record._remotePerm.toString()
<< "fileSize:" << record._fileSize << "checksum:" << record._checksumHeader
- << "e2eMangledName:" << record._e2eMangledName << "isE2eEncrypted:" << record._isE2eEncrypted;
+ << "e2eMangledName:" << record.e2eMangledName() << "isE2eEncrypted:" << record._isE2eEncrypted;
qlonglong phash = getPHash(record._path);
if (checkConnect()) {
SyncJournalFileRecord rec;
fillFileRecordFromGetQuery(rec, _listFilesInPathQuery);
if (!rec._path.startsWith(path) || rec._path.indexOf("/", path.size() + 1) > 0) {
- qWarning(lcDb) << "hash collision" << path << rec._path;
+ qWarning(lcDb) << "hash collision" << path << rec.path();
continue;
}
rowCallback(rec);
bool isDirectory() const { return _type == ItemTypeDirectory; }
bool isFile() const { return _type == ItemTypeFile || _type == ItemTypeVirtualFileDehydration; }
bool isVirtualFile() const { return _type == ItemTypeVirtualFile || _type == ItemTypeVirtualFileDownload; }
+ QString path() const { return QString::fromUtf8(_path); }
+ QString e2eMangledName() const { return QString::fromUtf8(_e2eMangledName); }
QByteArray _path;
quint64 _inode = 0;
<< " | inode: " << dbEntry._inode << "/" << localEntry.inode << "/"
<< " | type: " << dbEntry._type << "/" << localEntry.type << "/" << (serverEntry.isDirectory ? ItemTypeDirectory : ItemTypeFile)
<< " | e2ee: " << dbEntry._isE2eEncrypted << "/" << serverEntry.isE2eEncrypted
- << " | e2eeMangledName: " << dbEntry._e2eMangledName << "/" << serverEntry.e2eMangledName;
+ << " | e2eeMangledName: " << dbEntry.e2eMangledName() << "/" << serverEntry.e2eMangledName;
if (_discoveryData->isRenamed(path._original)) {
qCDebug(lcDisco) << "Ignoring renamed";
}
// Now we know there is a sane rename candidate.
- QString originalPath = QString::fromUtf8(base._path);
+ QString originalPath = base.path();
if (_discoveryData->isRenamed(originalPath)) {
qCInfo(lcDisco, "folder already has a rename entry, skipping");
dbError();
return;
}
- const auto originalPath = QString::fromUtf8(base._path);
+ const auto originalPath = base.path();
// Function to gradually check conditions for accepting a move-candidate
auto moveCheck = [&]() {
#include <QDir>
#include <QStringList>
#include <QtGlobal>
+#include <QTextCodec>
#include <qmetaobject.h>
#include <iostream>
}
_logstream.reset(new QTextStream(&_logFile));
+ _logstream->setCodec(QTextCodec::codecForName("UTF-8"));
}
void Logger::setLogExpire(int expire)
if (rec._type != ItemTypeVirtualFile && rec._type != ItemTypeVirtualFileDownload)
return;
- qCDebug(lcEngine) << "Removing db record for" << rec._path;
+ qCDebug(lcEngine) << "Removing db record for" << rec.path();
journal.deleteFileRecord(rec._path);
// If the local file is a dehydrated placeholder, wipe it too.
// Otherwise leave it to allow the next sync to have a new-new conflict.
QString localFile = localPath + rec._path;
if (QFile::exists(localFile) && vfs.isDehydratedPlaceholder(localFile)) {
- qCDebug(lcEngine) << "Removing local dehydrated placeholder" << rec._path;
+ qCDebug(lcEngine) << "Removing local dehydrated placeholder" << rec.path();
QFile::remove(localFile);
}
});
SyncFileItemPtr SyncFileItem::fromSyncJournalFileRecord(const SyncJournalFileRecord &rec)
{
auto item = SyncFileItemPtr::create();
- item->_file = QString::fromUtf8(rec._path);
+ item->_file = rec.path();
item->_inode = rec._inode;
item->_modtime = rec._modtime;
item->_type = rec._type;
item->_remotePerm = rec._remotePerm;
item->_serverHasIgnoredFiles = rec._serverHasIgnoredFiles;
item->_checksumHeader = rec._checksumHeader;
- item->_encryptedFileName = QString::fromUtf8(rec._e2eMangledName);
+ item->_encryptedFileName = rec.e2eMangledName();
item->_isEncrypted = rec._isE2eEncrypted;
return item;
}
{
FileInfo result;
_journalDb->getFilesBelowPath("", [&](const OCC::SyncJournalFileRecord &record) {
- auto components = PathComponents(QString::fromUtf8(record._path));
+ auto components = PathComponents(record.path());
auto &parentDir = findOrCreateDirs(result, components.parentDirComponents());
auto name = components.fileName();
auto &item = parentDir.children[name];