diff --git a/include/sqlpp11/boolean.h b/include/sqlpp11/boolean.h index be7b195d..1ae482ac 100644 --- a/include/sqlpp11/boolean.h +++ b/include/sqlpp11/boolean.h @@ -162,7 +162,7 @@ namespace sqlpp return _is_null; } - bool is_trivial() const + bool _is_trivial() const { if (not _is_valid) throw exception("accessing is_null in non-existing row"); diff --git a/include/sqlpp11/floating_point.h b/include/sqlpp11/floating_point.h index 37c69207..0feb7f7e 100644 --- a/include/sqlpp11/floating_point.h +++ b/include/sqlpp11/floating_point.h @@ -161,7 +161,7 @@ namespace sqlpp return _is_null; } - bool is_trivial() const + bool _is_trivial() const { if (not _is_valid) throw exception("accessing is_null in non-existing row"); diff --git a/include/sqlpp11/integral.h b/include/sqlpp11/integral.h index c1441fd3..f100e81b 100644 --- a/include/sqlpp11/integral.h +++ b/include/sqlpp11/integral.h @@ -162,7 +162,7 @@ namespace sqlpp return _is_null; } - bool is_trivial() const + bool _is_trivial() const { if (not _is_valid) throw exception("accessing is_null in non-existing row"); diff --git a/include/sqlpp11/rhs_is_trivial.h b/include/sqlpp11/rhs_is_trivial.h index 14de2675..5a38db17 100644 --- a/include/sqlpp11/rhs_is_trivial.h +++ b/include/sqlpp11/rhs_is_trivial.h @@ -63,7 +63,21 @@ namespace sqlpp { static bool _(const T& t) { - return t.is_trivial(); + if (null_is_trivial_value_t::value) + { + return t._is_trivial(); + } + else + { + if (t.is_null()) + { + return false; + } + else + { + return t._is_trivial(); + } + } } }; diff --git a/include/sqlpp11/text.h b/include/sqlpp11/text.h index d45544f3..d1ba51e2 100644 --- a/include/sqlpp11/text.h +++ b/include/sqlpp11/text.h @@ -164,7 +164,7 @@ namespace sqlpp return _value_ptr == nullptr; } - bool is_trivial() const + bool _is_trivial() const { if (not _is_valid) throw exception("accessing is_null in non-existing row"); diff --git a/include/sqlpp11/tvin.h b/include/sqlpp11/tvin.h index 7f3cce23..0c541972 100644 --- a/include/sqlpp11/tvin.h +++ b/include/sqlpp11/tvin.h @@ -155,8 +155,7 @@ namespace sqlpp auto tvin(Operand operand) -> tvin_arg_t::type> { using _operand_t = typename wrap_operand::type; - static_assert(std::is_same<_operand_t, text_operand>::value - or not std::is_same<_operand_t, Operand>::value, "tvin() used with invalid type (only string and primitive types allowed)"); + static_assert(not std::is_same<_operand_t, Operand>::value or is_result_field_t::value, "tvin() used with invalid type (only string and primitive types allowed)"); return {{operand}}; } diff --git a/include/sqlpp11/wrap_operand.h b/include/sqlpp11/wrap_operand.h index 0b0f8d23..b6926055 100644 --- a/include/sqlpp11/wrap_operand.h +++ b/include/sqlpp11/wrap_operand.h @@ -219,7 +219,7 @@ namespace sqlpp }; template - struct wrap_operand::value>::type> + struct wrap_operand::value and not is_result_field_t::value>::type> { using type = text_operand; };