mirror of
https://github.com/pocoproject/poco.git
synced 2025-05-25 14:34:04 +02:00

* fix(SQLParser): move to Data dir; add extradirs, remove vs 140,150 build scripts generation * fix(ActiveRecord): Makefile #4453 * fix(Data): Make SQLParser internal * fix(build): ODBC Makefile and Data libs CmakeLists #4453 * fix(build): Data libs CMakeLists #4453 * fix(build): regenerate VS projects #4453 * fix(CppUnit): remove Foundation dependency * fix(SQLParser): remove leftover unnecessary includes * fix(SQLParser): remove fwd header #4453 * fix(PocoDoc): remove SQLParser from include list * fix(mkrelease): remove 140,150 vs projects * fix(SQLParser): Disable SQL parsing by default #4462 * fix(test): Disable SQL parsing by default #4462 * Fix detection of odbc and apache2 for Fedora (#4461) * Fixed transaction handling in MySQL test when SQL parser is switched off * chore(ParallelSocketAcceptor): remove unnecessary include and using from header --------- Co-authored-by: Matej Kenda <matejken@gmail.com> Co-authored-by: topazus <77263945+topazus@users.noreply.github.com> Co-authored-by: Friedrich Wilckens <frwilckens@gmail.com>
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
#include "queries.h"
|
|
|
|
#include <filesystem>
|
|
#include <algorithm>
|
|
#include <iostream>
|
|
#include <regex>
|
|
|
|
#include "benchmark_utils.h"
|
|
|
|
namespace filesystem = std::filesystem;
|
|
|
|
std::string getQueryName(unsigned i) {
|
|
if (sql_queries[i].first.empty()) {
|
|
std::string name = "#" + std::to_string(i + 1);
|
|
return name;
|
|
}
|
|
return std::string("") + sql_queries[i].first;
|
|
}
|
|
|
|
std::vector<SQLQuery> getQueriesFromDirectory(const std::string& dir_path) {
|
|
std::regex query_file_regex("\\.sql$");
|
|
std::vector<std::string> files;
|
|
|
|
for (auto& entry : filesystem::directory_iterator(dir_path)) {
|
|
if (filesystem::is_regular_file(entry)) {
|
|
std::string path_str = filesystem::path(entry);
|
|
|
|
if (std::regex_search(path_str, query_file_regex)) {
|
|
files.push_back(path_str);
|
|
}
|
|
}
|
|
}
|
|
|
|
std::sort(files.begin(), files.end());
|
|
|
|
std::vector<SQLQuery> queries;
|
|
for (const std::string& file_path : files) {
|
|
const filesystem::path p(file_path);
|
|
const std::string query = readFileContents(file_path);
|
|
queries.emplace_back(p.filename(), query);
|
|
}
|
|
return queries;
|
|
}
|
|
|
|
std::vector<SQLQuery> getTPCHQueries() {
|
|
return getQueriesFromDirectory("test/queries/");
|
|
}
|