diff --git a/include/sqlpp11/expression_fwd.h b/include/sqlpp11/expression_fwd.h index 71958635..76fcb774 100644 --- a/include/sqlpp11/expression_fwd.h +++ b/include/sqlpp11/expression_fwd.h @@ -132,6 +132,21 @@ namespace sqlpp using _traits = make_traits; static constexpr const char* _name = "+"; }; + + template + struct bitwise_and + { + using _traits = make_traits; + static constexpr const char* _name = "&"; + }; + + template + struct bitwise_or + { + using _traits = make_traits; + static constexpr const char* _name = "|"; + }; + } template @@ -188,6 +203,11 @@ namespace sqlpp template using unary_minus_t = unary_expression_t, Rhs>; + template + using bitwise_and_t = binary_expression_t, Rhs>; + + template + using bitwise_or_t = binary_expression_t, Rhs>; } #endif diff --git a/include/sqlpp11/integral.h b/include/sqlpp11/integral.h index 003690ce..ecb9b14d 100644 --- a/include/sqlpp11/integral.h +++ b/include/sqlpp11/integral.h @@ -65,6 +65,21 @@ namespace sqlpp return *this; } + _parameter_t& operator=(const tvin_t>& t) + { + if (t._is_trivial()) + { + _value = 0; + _is_null = true; + } + else + { + _value = t._value._t; + _is_null = false; + } + return *this; + } + void set_null() { _value = 0; @@ -160,6 +175,25 @@ namespace sqlpp { return { *static_cast(this) }; } + + template + bitwise_and_t, wrap_operand_t> operator &(T t) const + { + using rhs = wrap_operand_t; + static_assert(_is_valid_operand::value, "invalid rhs operand"); + + return { *static_cast(this), {t} }; + } + + template + bitwise_or_t, wrap_operand_t> operator |(T t) const + { + using rhs = wrap_operand_t; + static_assert(_is_valid_operand::value, "invalid rhs operand"); + + return { *static_cast(this), {t} }; + } + }; template