diff options
author | louiz’ <louiz@louiz.org> | 2018-02-15 16:54:54 +0100 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2018-02-15 16:54:54 +0100 |
commit | dbb86bcc12921576c270009537b81b951d2ed84f (patch) | |
tree | 47006fb60bd6f9b72e2253191396a316e29992dd | |
parent | 505deda1763137fd807e16586c8a2e1aa978c647 (diff) | |
download | biboumi-dbb86bcc12921576c270009537b81b951d2ed84f.tar.gz biboumi-dbb86bcc12921576c270009537b81b951d2ed84f.tar.bz2 biboumi-dbb86bcc12921576c270009537b81b951d2ed84f.tar.xz biboumi-dbb86bcc12921576c270009537b81b951d2ed84f.zip |
Fix the actual_bind versions for integrals
-rw-r--r-- | src/database/query.cpp | 12 | ||||
-rw-r--r-- | src/database/query.hpp | 9 |
2 files changed, 7 insertions, 14 deletions
diff --git a/src/database/query.cpp b/src/database/query.cpp index 9611c97..d72066e 100644 --- a/src/database/query.cpp +++ b/src/database/query.cpp @@ -6,7 +6,7 @@ void actual_bind(Statement& statement, const std::string& value, int index) statement.bind_text(index, value); } -void actual_bind(Statement& statement, const std::int64_t value, int index) +void actual_bind(Statement& statement, const std::int64_t& value, int index) { statement.bind_int64(index, value); } @@ -21,16 +21,6 @@ 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<std::int64_t>(value), index); -} - -void actual_bind(Statement& statement, const int value, int index) -{ - actual_bind(statement, static_cast<std::int64_t>(value), index); -} - void actual_add_param(Query& query, const std::string& val) { query.params.push_back(val); diff --git a/src/database/query.hpp b/src/database/query.hpp index 25c3a62..ba28b1a 100644 --- a/src/database/query.hpp +++ b/src/database/query.hpp @@ -12,9 +12,12 @@ #include <string> 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 std::int64_t& value, int index); +template <typename T, typename std::enable_if_t<std::is_integral<T>::value>* = 0> +void actual_bind(Statement& statement, const T& value, int index) +{ + actual_bind(statement, static_cast<std::int64_t>(value), index); +} void actual_bind(Statement& statement, const OptionalBool& value, int index); #ifdef DEBUG_SQL_QUERIES |