Using OptionalBool, add RecordHistoryOptional col into IrcChannelOptions table
ref #3269
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
#include <logger/logger.hpp>
|
||||
#include <database/row.hpp>
|
||||
|
||||
#include <utils/optional_bool.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
@@ -20,7 +22,7 @@ extract_row_value(Statement& statement, const int i)
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::is_same<std::string, T>::value, std::string>::type
|
||||
typename std::enable_if<std::is_same<std::string, T>::value, T>::type
|
||||
extract_row_value(Statement& statement, const int i)
|
||||
{
|
||||
const auto size = sqlite3_column_bytes(statement.get(), i);
|
||||
@@ -29,6 +31,19 @@ extract_row_value(Statement& statement, const int i)
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::is_same<OptionalBool, T>::value, T>::type
|
||||
extract_row_value(Statement& statement, const int i)
|
||||
{
|
||||
const auto integer = sqlite3_column_int(statement.get(), i);
|
||||
OptionalBool result;
|
||||
if (integer > 0)
|
||||
result.set_value(true);
|
||||
else if (integer < 0)
|
||||
result.set_value(false);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <std::size_t N=0, typename... T>
|
||||
typename std::enable_if<N < sizeof...(T), void>::type
|
||||
extract_row_values(Row<T...>& row, Statement& statement)
|
||||
|
||||
Reference in New Issue
Block a user