diff --git a/include/sqlpp11/detail/basic_operators.h b/include/sqlpp11/detail/basic_operators.h index 02a2a3ae..a534cb00 100644 --- a/include/sqlpp11/detail/basic_operators.h +++ b/include/sqlpp11/detail/basic_operators.h @@ -127,12 +127,12 @@ namespace sqlpp return { *static_cast(this), std::forward(t) }; } - nary_expression_t is_null() const + null_expression_t is_null() const { return { *static_cast(this) }; } - nary_expression_t is_not_null() const + null_expression_t is_not_null() const { return { *static_cast(this) }; } @@ -147,7 +147,7 @@ namespace sqlpp return { *static_cast(this) }; } - // Hint: use wrappers for containers... + // Hint: use value_list wrapper for containers... template nary_expression_t::type...> in(T&&... t) const { diff --git a/include/sqlpp11/expression.h b/include/sqlpp11/expression.h index 7e2e947d..844d70fb 100644 --- a/include/sqlpp11/expression.h +++ b/include/sqlpp11/expression.h @@ -172,6 +172,38 @@ namespace sqlpp Lhs _lhs; }; + template + struct null_expression_t: public O::_value_type::template operators> + { + using _value_type = typename O::_value_type; + + null_expression_t(Lhs&& l): + _lhs(std::move(l)) + {} + + null_expression_t(const Lhs& l): + _lhs(l) + {} + + null_expression_t(const null_expression_t&) = default; + null_expression_t(null_expression_t&&) = default; + null_expression_t& operator=(const null_expression_t&) = default; + null_expression_t& operator=(null_expression_t&&) = default; + ~null_expression_t() = default; + + template + void serialize(std::ostream& os, Db& db) const + { + os << "("; + _lhs.serialize(os, db); + os << ")"; + os << O::_name; + } + + private: + Lhs _lhs; + }; + template struct nary_expression_t: public O::_value_type::template operators> {