data: Allow a complete file to become incomplete again if it has errors in a later translation unit

This commit is contained in:
Eberhard Graether
2018-06-20 23:56:18 +02:00
parent c7872831e9
commit e287c86315
2 changed files with 6 additions and 8 deletions
+1 -1
View File
@@ -90,7 +90,7 @@ void PersistentStorage::addFile(const StorageFile& data)
m_sqliteIndexStorage.setFileIndexed(storedFile.id, data.indexed);
}
if (!storedFile.complete && data.complete)
if (storedFile.complete != data.complete)
{
m_sqliteIndexStorage.setFileCompleteIfNoError(storedFile.id, storedFile.filePath, data.complete);
}
@@ -650,15 +650,13 @@ void SqliteIndexStorage::setFileIndexed(Id fileId, bool indexed)
void SqliteIndexStorage::setFileCompleteIfNoError(Id fileId, const std::wstring& filePath, bool complete)
{
StorageError error = doGetFirst<StorageError>("WHERE file_path == '" + utility::encodeToUtf8(filePath) + "'");
if (error.id)
bool fileHasErrors = doGetFirst<StorageError>("WHERE file_path == '" + utility::encodeToUtf8(filePath) + "'").id;
if (fileHasErrors != complete)
{
return;
executeStatement(
"UPDATE file SET complete = " + std::to_string(complete) + " WHERE id == " + std::to_string(fileId) + ";"
);
}
executeStatement(
"UPDATE file SET complete = " + std::to_string(complete) + " WHERE id == " + std::to_string(fileId) + ";"
);
}
void SqliteIndexStorage::setNodeType(int type, Id nodeId)