sqlitedbservice,indexer: Add runWalCheckpoint() and call it after indexing

这个提交包含在:
Albert S. 2024-05-23 18:16:41 +02:00
父节点 048b90ad85
当前提交 99dce53a6d
共有 2 个文件被更改,包括 7 次插入0 次删除

查看文件

@ -163,6 +163,7 @@ void Indexer::processFinishedWorker()
--this->runningWorkers;
if(!isRunning())
{
this->db->runWalCheckpoint();
emit finished();
}
}

查看文件

@ -276,6 +276,12 @@ bool SqliteDbService::insertOutline(QSqlDatabase &db, int fileid, const QVector<
return true;
}
bool SqliteDbService::runWalCheckpoint()
{
auto query = QSqlQuery(dbFactory->forCurrentThread());
return query.exec("PRAGMA wal_checkpoint(TRUNCATE);");
}
QSqlQuery SqliteDbService::exec(QString querystr, std::initializer_list<QVariant> args)
{
auto query = QSqlQuery(dbFactory->forCurrentThread());