Add a DEBUG_SQL_QUERIES to log info about the executed SQL queries

fix #3324
This commit is contained in:
louiz’
2018-01-14 21:46:49 +01:00
parent 3cd6490236
commit 7e64a2e361
11 changed files with 82 additions and 0 deletions
+7
View File
@@ -6,6 +6,8 @@
#include <database/sqlite3_statement.hpp>
#include <database/query.hpp>
#include <utils/tolower.hpp>
#include <logger/logger.hpp>
#include <vector>
@@ -57,6 +59,11 @@ std::unique_ptr<DatabaseEngine> Sqlite3Engine::open(const std::string& filename)
std::tuple<bool, std::string> Sqlite3Engine::raw_exec(const std::string& query)
{
#ifdef DEBUG_SQL_QUERIES
log_debug("SQL QUERY: ", query);
const auto timer = make_sql_timer();
#endif
char* error;
const auto result = sqlite3_exec(db, query.data(), nullptr, nullptr, &error);
if (result != SQLITE_OK)