Simplified a check in unit tests

This commit is contained in:
emeric
2025-06-15 14:41:58 +02:00
parent f657427654
commit 424876ee1c
4 changed files with 15 additions and 31 deletions
+10
View File
@@ -397,6 +397,16 @@ namespace lms::db
LMS_LOG(DB, INFO, "Analyze complete!");
}
bool Session::areAllTablesEmpty()
{
const std::vector<std::string> entryList{ utils::fetchQueryResults(_session.query<std::string>("SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'")) };
return std::all_of(entryList.cbegin(), entryList.cend(), [this](const std::string& entry) {
const auto count{ utils::fetchQuerySingleResult(_session.query<long>("SELECT COUNT(*) FROM " + entry)) };
return count == 0;
});
}
void Session::retrieveEntriesToAnalyze(std::vector<std::string>& entryList)
{
auto transaction{ createReadTransaction() };