summaryrefslogtreecommitdiff
path: root/src/database
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-07-08 18:11:25 +0200
committerlouiz’ <louiz@louiz.org>2017-07-08 18:11:25 +0200
commitfd7ee48a86aee6a6c83cc22a167717de781ed3f6 (patch)
treeeb273cbc9b421ff006d5cb4d2210b89595b28d23 /src/database
parent9fa1852c7ea094086f45e840fa22cc83d56b744e (diff)
downloadbiboumi-fd7ee48a86aee6a6c83cc22a167717de781ed3f6.tar.gz
biboumi-fd7ee48a86aee6a6c83cc22a167717de781ed3f6.tar.bz2
biboumi-fd7ee48a86aee6a6c83cc22a167717de781ed3f6.tar.xz
biboumi-fd7ee48a86aee6a6c83cc22a167717de781ed3f6.zip
Remove many log_debug from the database module
Diffstat (limited to 'src/database')
-rw-r--r--src/database/count_query.hpp1
-rw-r--r--src/database/insert_query.hpp4
-rw-r--r--src/database/query.hpp5
-rw-r--r--src/database/row.hpp3
-rw-r--r--src/database/table.cpp2
-rw-r--r--src/database/table.hpp5
6 files changed, 1 insertions, 19 deletions
diff --git a/src/database/count_query.hpp b/src/database/count_query.hpp
index b7bbf51..0dde63c 100644
--- a/src/database/count_query.hpp
+++ b/src/database/count_query.hpp
@@ -29,7 +29,6 @@ struct CountQuery: public Query
if (sqlite3_step(statement.get()) != SQLITE_DONE)
log_warning("Count request returned more than one result.");
- log_debug("Returning count: ", res);
return res;
}
};
diff --git a/src/database/insert_query.hpp b/src/database/insert_query.hpp
index 9e410ce..2ece69d 100644
--- a/src/database/insert_query.hpp
+++ b/src/database/insert_query.hpp
@@ -20,8 +20,6 @@ actual_bind(Statement& statement, std::vector<std::string>& params, const std::t
params.erase(params.begin());
if (sqlite3_bind_text(statement.get(), N + 1, value.data(), static_cast<int>(value.size()), SQLITE_TRANSIENT) != SQLITE_OK)
log_error("Failed to bind ", value, " to param ", N);
- else
- log_debug("Bound (not id) [", value, "] to ", N);
}
template <int N, typename ColumnType, typename... T>
@@ -36,8 +34,6 @@ actual_bind(Statement& statement, std::vector<std::string>&, const std::tuple<T.
}
else if (sqlite3_bind_null(statement.get(), N + 1) != SQLITE_OK)
log_error("Failed to bind NULL to param ", N);
- else
- log_debug("Bound NULL to ", N);
}
struct InsertQuery: public Query
diff --git a/src/database/query.hpp b/src/database/query.hpp
index f103fe9..6e1db12 100644
--- a/src/database/query.hpp
+++ b/src/database/query.hpp
@@ -23,7 +23,6 @@ struct Query
Statement prepare(sqlite3* db)
{
sqlite3_stmt* stmt;
- log_debug(this->body);
auto res = sqlite3_prepare(db, this->body.data(), static_cast<int>(this->body.size()) + 1,
&stmt, nullptr);
if (res != SQLITE_OK)
@@ -36,9 +35,7 @@ struct Query
for (const std::string& param: this->params)
{
if (sqlite3_bind_text(statement.get(), i, param.data(), static_cast<int>(param.size()), SQLITE_TRANSIENT) != SQLITE_OK)
- log_debug("Failed to bind ", param, " to param ", i);
- else
- log_debug("Bound ", param, " to ", i);
+ log_error("Failed to bind ", param, " to param ", i);
i++;
}
diff --git a/src/database/row.hpp b/src/database/row.hpp
index a8e8579..2b50874 100644
--- a/src/database/row.hpp
+++ b/src/database/row.hpp
@@ -17,9 +17,7 @@ typename std::enable_if<std::is_same<std::decay_t<ColumnType>, Id>::value, void>
update_id(std::tuple<T...>& columns, sqlite3* db)
{
auto&& column = std::get<ColumnType>(columns);
- log_debug("Found an autoincrement col.");
auto res = sqlite3_last_insert_rowid(db);
- log_debug("Value is now: ", res);
column.value = static_cast<Id::real_type>(res);
}
@@ -63,7 +61,6 @@ struct Row
InsertQuery query(this->table_name);
query.insert_col_names(this->columns);
query.insert_values(this->columns);
- log_debug(query.body);
query.execute(this->columns, db);
diff --git a/src/database/table.cpp b/src/database/table.cpp
index 160f426..9224d79 100644
--- a/src/database/table.cpp
+++ b/src/database/table.cpp
@@ -5,11 +5,9 @@ std::set<std::string> get_all_columns_from_table(sqlite3* db, const std::string&
std::set<std::string> result;
char* errmsg;
std::string query{"PRAGMA table_info(" + table_name + ")"};
- log_debug(query);
int res = sqlite3_exec(db, query.data(), [](void* param, int columns_nb, char** columns, char**) -> int {
constexpr int name_column = 1;
std::set<std::string>* result = static_cast<std::set<std::string>*>(param);
- log_debug("Table has column ", columns[name_column]);
if (name_column < columns_nb)
result->insert(columns[name_column]);
return 0;
diff --git a/src/database/table.hpp b/src/database/table.hpp
index c9e35d3..24418d9 100644
--- a/src/database/table.hpp
+++ b/src/database/table.hpp
@@ -2,7 +2,6 @@
#include <database/select_query.hpp>
#include <database/type_to_sql.hpp>
-#include <logger/logger.hpp>
#include <database/row.hpp>
#include <algorithm>
@@ -18,7 +17,6 @@ void add_column_to_table(sqlite3* db, const std::string& table_name)
{
const std::string name = ColumnType::name;
std::string query{"ALTER TABLE " + table_name + " ADD " + ColumnType::name + " " + TypeToSQLType<typename ColumnType::real_type>::type};
- log_debug(query);
char* error;
const auto result = sqlite3_exec(db, query.data(), nullptr, nullptr, &error);
if (result != SQLITE_OK)
@@ -66,11 +64,8 @@ class Table
this->add_column_create(res);
res += ")";
- log_debug(res);
-
char* error;
const auto result = sqlite3_exec(db, res.data(), nullptr, nullptr, &error);
- log_debug("result: ", +result);
if (result != SQLITE_OK)
{
log_error("Error executing query: ", error);