10 #ifdef BENCHMAX_DATABASE
16 #include "../logging.h"
17 #include "../tools/Tool.h"
21 namespace fs = std::filesystem;
23 #ifdef BENCHMAX_DATABASE
38 Index id = conn.insert(
"INSERT INTO main_tool (`interface`, `hash`) VALUES (%0q, %1q)", tool->name(), tool->attributeHash());
39 DBAL::Statement stmt = conn.prepare(
"INSERT INTO main_toolattribute (`key`, `value`, `tool_id`) VALUES (%0q, %1q, %2q)");
40 for (
const auto& it: tool->attributes()) {
41 conn.execute(stmt, it.first, it.second,
id);
48 DBAL::Results res = conn.select(
"SELECT id FROM main_tool WHERE `interface` = %0q AND `hash` = %1q", tool->name(), tool->attributeHash());
49 if (conn.size(res) == 0) {
52 assert(conn.size(res) == 1);
53 return conn.getIndex(res,
"id");
58 return conn.insert(
"INSERT INTO main_file (`filename`) VALUES (%0q)", file.native());
63 DBAL::Results res = conn.select(
"SELECT id FROM main_file WHERE `filename` = %0q", file.native());
64 if (conn.size(res) == 0) {
67 assert(conn.size(res) == 1);
68 return conn.getIndex(res,
"id");
73 return conn.insert(
"INSERT INTO main_benchmark () VALUES ()");
78 return conn.insert(
"INSERT INTO main_benchmarkresult (`exitcode`, `time`, `memory`, `benchmark_id`, `tool_id`, `file_id`) VALUES (%0q, %1q, %2q, %3q, %4q, %5q)", exitCode, time, std::size_t(0), benchmark, tool, file);
83 conn.insert(
"INSERT INTO main_benchmarkattribute (`key`, `value`, `result_id`) VALUES (%0q, %1q, %2q)", key, value, benchmarkResult);
88 if (!conn.connect(
"benchmarks",
"ths.informatik.rwth-aachen.de",
"benchmax",
"Km2FLeJJ2wX3nMqq")) {
#define BENCHMAX_LOG_FATAL(channel, msg)
Log fatal errors.
std::unique_ptr< sql::ResultSet > Results
Results type.
std::unique_ptr< sql::PreparedStatement > Statement
Statement type.
std::size_t Index
Indec type.
Dummy database that effectively disables storing to database. Set BENCHMAX_DATABASE to actually use a...
Index getToolID(const Tool *)
Dummy.
void addBenchmarkAttribute(Index, const std::string &, const std::string &)
Dummy.
Index createBenchmark()
Dummy.
Index addBenchmarkResult(Index, Index, Index, int, std::size_t)
Dummy.
Index getFileID(const fs::path &)
Dummy.
std::size_t Index
Dummy index type.
Index addTool(const Tool *)
Dummy.
Index addFile(const fs::path &)
Dummy.