From fd9c7139386e773ee64fe970089d77fede75181f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sun, 11 Feb 2018 23:39:42 +0100 Subject: Fix a few warnings --- src/database/column.hpp | 2 +- src/database/insert_query.hpp | 2 +- src/database/query.cpp | 9 +++++++++ src/database/query.hpp | 2 ++ src/database/sqlite3_statement.hpp | 1 - 5 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src/database') diff --git a/src/database/column.hpp b/src/database/column.hpp index 1f16bcf..9367701 100644 --- a/src/database/column.hpp +++ b/src/database/column.hpp @@ -18,5 +18,5 @@ struct Id: Column { static constexpr auto name = "id_"; static constexpr auto options = "PRIMARY KEY"; - Id(): Column(-1) {} + Id(): Column(unset_value) {} }; diff --git a/src/database/insert_query.hpp b/src/database/insert_query.hpp index 9726424..04c098c 100644 --- a/src/database/insert_query.hpp +++ b/src/database/insert_query.hpp @@ -22,7 +22,7 @@ update_autoincrement_id(std::tuple& columns, Statement& statement) template typename std::enable_if::type -update_autoincrement_id(std::tuple&, Statement& statement) +update_autoincrement_id(std::tuple&, Statement&) {} struct InsertQuery: public Query diff --git a/src/database/query.cpp b/src/database/query.cpp index d27dc59..9611c97 100644 --- a/src/database/query.cpp +++ b/src/database/query.cpp @@ -21,6 +21,15 @@ void actual_bind(Statement& statement, const OptionalBool& value, int index) statement.bind_int64(index, -1); } +void actual_bind(Statement& statement, const std::size_t value, int index) +{ + actual_bind(statement, static_cast(value), index); +} + +void actual_bind(Statement& statement, const int value, int index) +{ + actual_bind(statement, static_cast(value), index); +} void actual_add_param(Query& query, const std::string& val) { diff --git a/src/database/query.hpp b/src/database/query.hpp index 8434944..25c3a62 100644 --- a/src/database/query.hpp +++ b/src/database/query.hpp @@ -13,6 +13,8 @@ void actual_bind(Statement& statement, const std::string& value, int index); void actual_bind(Statement& statement, const std::int64_t value, int index); +void actual_bind(Statement& statement, const std::size_t value, int index); +void actual_bind(Statement& statement, const int value, int index); void actual_bind(Statement& statement, const OptionalBool& value, int index); #ifdef DEBUG_SQL_QUERIES diff --git a/src/database/sqlite3_statement.hpp b/src/database/sqlite3_statement.hpp index 7738fa6..3ed60c0 100644 --- a/src/database/sqlite3_statement.hpp +++ b/src/database/sqlite3_statement.hpp @@ -88,5 +88,4 @@ class Sqlite3Statement: public Statement private: sqlite3_stmt* stmt; - int last_step_result{SQLITE_OK}; }; -- cgit v1.2.3