diff options
Diffstat (limited to 'src/database')
-rw-r--r-- | src/database/database.cpp | 4 | ||||
-rw-r--r-- | src/database/query.cpp | 5 | ||||
-rw-r--r-- | src/database/query.hpp | 9 |
3 files changed, 5 insertions, 13 deletions
diff --git a/src/database/database.cpp b/src/database/database.cpp index 3578c04..9037ce1 100644 --- a/src/database/database.cpp +++ b/src/database/database.cpp @@ -162,10 +162,6 @@ Database::IrcChannelOptions Database::get_irc_channel_options_with_server_and_gl coptions.col<EncodingOut>() = get_first_non_empty(coptions.col<EncodingOut>(), soptions.col<EncodingOut>()); - coptions.col<MaxHistoryLength>() = get_first_non_empty(coptions.col<MaxHistoryLength>(), - soptions.col<MaxHistoryLength>(), - goptions.col<MaxHistoryLength>()); - return coptions; } diff --git a/src/database/query.cpp b/src/database/query.cpp index d72066e..5ec8599 100644 --- a/src/database/query.cpp +++ b/src/database/query.cpp @@ -6,11 +6,6 @@ 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) -{ - statement.bind_int64(index, value); -} - void actual_bind(Statement& statement, const OptionalBool& value, int index) { if (!value.is_set) diff --git a/src/database/query.hpp b/src/database/query.hpp index ba28b1a..ae6e946 100644 --- a/src/database/query.hpp +++ b/src/database/query.hpp @@ -12,13 +12,14 @@ #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); -template <typename T, typename std::enable_if_t<std::is_integral<T>::value>* = 0> +void actual_bind(Statement& statement, const OptionalBool& value, int index); +template <typename T> void actual_bind(Statement& statement, const T& value, int index) { - actual_bind(statement, static_cast<std::int64_t>(value), index); + static_assert(std::is_integral<T>::value, + "Only a string, an optional-bool or an integer can be used."); + statement.bind_int64(index, static_cast<int>(value)); } -void actual_bind(Statement& statement, const OptionalBool& value, int index); #ifdef DEBUG_SQL_QUERIES #include <utils/scopetimer.hpp> |