0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 04:47:18 +08:00

Added storage type to parameter_value_base struct

This allows to store bool as signed char, the latter being the usual
data type in connector libraries afaict
This commit is contained in:
rbock 2015-10-31 11:03:20 +01:00
parent 21d633bdf4
commit fae1f08d93
2 changed files with 5 additions and 4 deletions

View File

@ -35,9 +35,9 @@
namespace sqlpp namespace sqlpp
{ {
template <> template <>
struct parameter_value_t<boolean> : public base_parameter_value<boolean> struct parameter_value_t<boolean> : public base_parameter_value<boolean, signed char>
{ {
using base = base_parameter_value<boolean>; using base = base_parameter_value<boolean, signed char>;
using base::base; using base::base;
using base::operator=; using base::operator=;

View File

@ -32,11 +32,12 @@
namespace sqlpp namespace sqlpp
{ {
template <typename DataType> template <typename DataType, typename StorageType = typename DataType::_cpp_value_type>
struct base_parameter_value struct base_parameter_value
{ {
using _value_type = DataType; using _value_type = DataType;
using _cpp_value_type = typename _value_type::_cpp_value_type; using _cpp_value_type = typename _value_type::_cpp_value_type;
using _cpp_storage_type = StorageType;
base_parameter_value() : _value{}, _is_null{true} base_parameter_value() : _value{}, _is_null{true}
{ {
@ -90,7 +91,7 @@ namespace sqlpp
} }
protected: protected:
_cpp_value_type _value; _cpp_storage_type _value;
bool _is_null; bool _is_null;
}; };
} }