Merge pull request #350 from nextcloud/upstream/pr/6436

SyncJournalDb::setSelectiveSyncList: Always use a transaction
This commit is contained in:
Roeland Jago Douma 2018-06-05 11:30:24 +02:00 committed by GitHub
commit 3ce41c71c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1886,6 +1886,8 @@ void SyncJournalDb::setSelectiveSyncList(SyncJournalDb::SelectiveSyncListType ty
return; return;
} }
startTransaction();
//first, delete all entries of this type //first, delete all entries of this type
SqlQuery delQuery("DELETE FROM selectivesync WHERE type == ?1", _db); SqlQuery delQuery("DELETE FROM selectivesync WHERE type == ?1", _db);
delQuery.bindValue(1, int(type)); delQuery.bindValue(1, int(type));
@ -1902,6 +1904,8 @@ void SyncJournalDb::setSelectiveSyncList(SyncJournalDb::SelectiveSyncListType ty
qCWarning(lcDb) << "SQL error when inserting into selective sync" << type << path << delQuery.error(); qCWarning(lcDb) << "SQL error when inserting into selective sync" << type << path << delQuery.error();
} }
} }
commitInternal("setSelectiveSyncList");
} }
void SyncJournalDb::avoidRenamesOnNextSync(const QByteArray &path) void SyncJournalDb::avoidRenamesOnNextSync(const QByteArray &path)