data: increased file clearing performance
This change passes all file node ids for clearing to the sqlite storage at once and makes use of ON DELETE CASCADE for everything else, instead of manally deleting all source locations.
This commit is contained in:
@@ -76,15 +76,18 @@ std::set<FilePath> Storage::getDependingFilePaths(const FilePath& filePath)
|
||||
return dependingFilePaths;
|
||||
}
|
||||
|
||||
void Storage::clearFileElement(const FilePath& filePath)
|
||||
void Storage::clearFileElements(const std::vector<FilePath>& filePaths)
|
||||
{
|
||||
Id fileId = getFileNodeId(filePath);
|
||||
if (fileId != 0)
|
||||
std::vector<Id> fileNodeIds;
|
||||
|
||||
for (const FilePath& path : filePaths)
|
||||
{
|
||||
m_sqliteStorage.beginTransaction();
|
||||
m_sqliteStorage.removeElementsWithLocationInFile(fileId);
|
||||
m_sqliteStorage.removeFile(fileId);
|
||||
m_sqliteStorage.commitTransaction();
|
||||
fileNodeIds.push_back(getFileNodeId(path));
|
||||
}
|
||||
|
||||
if (fileNodeIds.size())
|
||||
{
|
||||
m_sqliteStorage.removeFiles(fileNodeIds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user