[CSE] Implementation of the setE2eRelation

This call creates a new entry on the database for e2e.
This commit is contained in:
Tomaz Canabrava 2018-01-28 18:05:28 +01:00
parent 32eaaa0601
commit a003d216a5
2 changed files with 22 additions and 0 deletions

View file

@ -1444,6 +1444,27 @@ QString SyncJournalDb::getE2eMangledName(const QString& originalName)
return _getE2eFileMangledName->stringValue(0);
}
bool SyncJournalDb::setE2eRelation(const QString& mangledName, const QString& originalName)
{
Q_ASSERT(!mangledName.isEmpty());
Q_ASSERT(!originalName.isEmpty());
if (mangledName.isEmpty()) {
qCDebug(lcDb) << "Cant create e2e relation on the database, mangled name is empty.";
return false;
}
if (originalName.isEmpty()) {
qCDebug(lcDb) << "Cant create e2e relation on the database, original name is empty.";
return false;
}
_setE2eFileRelationQuery->reset_and_clear_bindings();
_setE2eFileRelationQuery->bindValue(1, mangledName);
_setE2eFileRelationQuery->bindValue(2, originalName);
return _setE2eFileRelationQuery->exec();
}
QVector<SyncJournalDb::DownloadInfo> SyncJournalDb::getAndDeleteStaleDownloadInfos(const QSet<QString> &keep)
{
QVector<SyncJournalDb::DownloadInfo> empty_result;

View file

@ -138,6 +138,7 @@ public:
void avoidRenamesOnNextSync(const QByteArray &path);
void setPollInfo(const PollInfo &);
bool setE2eRelation(const QString& mangledName, const QString& originalName);
QString getE2eMangledName(const QString& originalName);
QVector<PollInfo> getPollInfos();