From 5834dd53f32ff89f5818681a93e416b0a48b6254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 14 Jun 2017 16:21:23 +0200 Subject: Add a 0 default value for template argument N --- src/database/insert_query.hpp | 18 +++++++++--------- src/database/row.hpp | 6 +++--- src/database/select_query.hpp | 6 +++--- src/database/table.hpp | 6 +++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/database/insert_query.hpp b/src/database/insert_query.hpp index 4965fc0..9e410ce 100644 --- a/src/database/insert_query.hpp +++ b/src/database/insert_query.hpp @@ -53,13 +53,13 @@ struct InsertQuery: public Query { auto statement = this->prepare(db); { - this->bind_param<0>(columns, statement); + this->bind_param(columns, statement); if (sqlite3_step(statement.get()) != SQLITE_DONE) log_error("Failed to execute query: ", sqlite3_errmsg(db)); } } - template + template typename std::enable_if::type bind_param(const std::tuple& columns, Statement& statement) { @@ -69,7 +69,7 @@ struct InsertQuery: public Query this->bind_param(columns, statement); } - template + template typename std::enable_if::type bind_param(const std::tuple&, Statement&) {} @@ -78,11 +78,11 @@ struct InsertQuery: public Query void insert_values(const std::tuple& columns) { this->body += "VALUES ("; - this->insert_value<0>(columns); + this->insert_value(columns); this->body += ")"; } - template + template typename std::enable_if::type insert_value(const std::tuple& columns) { @@ -93,7 +93,7 @@ struct InsertQuery: public Query add_param(*this, std::get(columns)); this->insert_value(columns); } - template + template typename std::enable_if::type insert_value(const std::tuple&) { } @@ -102,11 +102,11 @@ struct InsertQuery: public Query void insert_col_names(const std::tuple& columns) { this->body += " ("; - this->insert_col_name<0>(columns); + this->insert_col_name(columns); this->body += ")\n"; } - template + template typename std::enable_if::type insert_col_name(const std::tuple& columns) { @@ -119,7 +119,7 @@ struct InsertQuery: public Query this->insert_col_name(columns); } - template + template typename std::enable_if::type insert_col_name(const std::tuple&) {} diff --git a/src/database/row.hpp b/src/database/row.hpp index b6887cb..e7a58c4 100644 --- a/src/database/row.hpp +++ b/src/database/row.hpp @@ -23,7 +23,7 @@ update_id(std::tuple& columns, sqlite3* db) column.value = static_cast(res); } -template +template typename std::enable_if::type update_autoincrement_id(std::tuple& columns, sqlite3* db) { @@ -32,7 +32,7 @@ update_autoincrement_id(std::tuple& columns, sqlite3* db) update_autoincrement_id(columns, db); } -template +template typename std::enable_if::type update_autoincrement_id(std::tuple&, sqlite3*) {} @@ -67,7 +67,7 @@ struct Row query.execute(this->columns, db); - update_autoincrement_id<0>(this->columns, db); + update_autoincrement_id(this->columns, db); } std::tuple columns; diff --git a/src/database/select_query.hpp b/src/database/select_query.hpp index d0c1d59..93d69ed 100644 --- a/src/database/select_query.hpp +++ b/src/database/select_query.hpp @@ -53,11 +53,11 @@ struct SelectQuery: public Query Query("SELECT"), table_name(table_name) { - this->insert_col_name<0>(); + this->insert_col_name(); this->body += " from " + this->table_name; } - template + template typename std::enable_if::type insert_col_name() { @@ -71,7 +71,7 @@ struct SelectQuery: public Query this->insert_col_name(); } - template + template typename std::enable_if::type insert_col_name() {} diff --git a/src/database/table.hpp b/src/database/table.hpp index 163b97f..dc871c3 100644 --- a/src/database/table.hpp +++ b/src/database/table.hpp @@ -26,7 +26,7 @@ class Table std::string res{"CREATE TABLE IF NOT EXISTS "}; res += this->name; res += " (\n"; - this->add_column_create<0>(res); + this->add_column_create(res); res += ")"; log_debug(res); @@ -58,7 +58,7 @@ class Table } private: - template + template typename std::enable_if::type add_column_create(std::string& str) { @@ -75,7 +75,7 @@ class Table add_column_create(str); } - template + template typename std::enable_if::type add_column_create(std::string&) { } -- cgit v1.2.3