diff --git a/include/sqlpp11/basic_expression_operators.h b/include/sqlpp11/basic_expression_operators.h index 3b66a8ae..5f8e211e 100644 --- a/include/sqlpp11/basic_expression_operators.h +++ b/include/sqlpp11/basic_expression_operators.h @@ -218,6 +218,27 @@ namespace sqlpp check_rhs_in_arguments_t...>::_(); return {*static_cast(this), wrap_operand_t{t}...}; } + + template + auto operator not() const -> return_type_not_t + { + return_type_not::check::_(); + return {*static_cast(this)}; + } + + template + auto operator and(const R& r) const -> return_type_and_t + { + return_type_and::check::_(); + return {*static_cast(this), wrap_operand_t{r}}; + } + + template + auto operator or(const R& r) const -> return_type_or_t + { + return_type_or::check::_(); + return {*static_cast(this), wrap_operand_t{r}}; + } }; } diff --git a/include/sqlpp11/data_types/boolean/data_type.h b/include/sqlpp11/data_types/boolean/data_type.h index 25f6d1f5..66528c63 100644 --- a/include/sqlpp11/data_types/boolean/data_type.h +++ b/include/sqlpp11/data_types/boolean/data_type.h @@ -33,7 +33,7 @@ namespace sqlpp { struct boolean { - // using _traits = make_traits; + using _traits = make_traits; using _cpp_value_type = bool; template diff --git a/include/sqlpp11/data_types/boolean/expression_operators.h b/include/sqlpp11/data_types/boolean/expression_operators.h index 7d934910..1e890b3e 100644 --- a/include/sqlpp11/data_types/boolean/expression_operators.h +++ b/include/sqlpp11/data_types/boolean/expression_operators.h @@ -27,7 +27,7 @@ #ifndef SQLPP_BOOLEAN_EXPRESSION_OPERATORS_H #define SQLPP_BOOLEAN_EXPRESSION_OPERATORS_H -#include +//#include #include #include #include @@ -54,8 +54,8 @@ namespace sqlpp using type = logical_or_t, wrap_operand_t>; }; - template - struct return_type_not> + template + struct return_type_not> { using check = consistent_t; using type = logical_not_t>; diff --git a/include/sqlpp11/data_types/day_point/data_type.h b/include/sqlpp11/data_types/day_point/data_type.h index 0a2b1df1..a589e752 100644 --- a/include/sqlpp11/data_types/day_point/data_type.h +++ b/include/sqlpp11/data_types/day_point/data_type.h @@ -34,7 +34,7 @@ namespace sqlpp { struct day_point { - using _traits = make_traits; + using _traits = make_traits; using _cpp_value_type = ::sqlpp::chrono::day_point; template diff --git a/include/sqlpp11/data_types/floating_point/data_type.h b/include/sqlpp11/data_types/floating_point/data_type.h index 418b89bb..6c7e6a2f 100644 --- a/include/sqlpp11/data_types/floating_point/data_type.h +++ b/include/sqlpp11/data_types/floating_point/data_type.h @@ -33,7 +33,7 @@ namespace sqlpp { struct floating_point { - using _traits = make_traits; + using _traits = make_traits; using _cpp_value_type = double; template diff --git a/include/sqlpp11/data_types/integral/data_type.h b/include/sqlpp11/data_types/integral/data_type.h index 550421d4..cc60e273 100644 --- a/include/sqlpp11/data_types/integral/data_type.h +++ b/include/sqlpp11/data_types/integral/data_type.h @@ -33,7 +33,7 @@ namespace sqlpp { struct integral { - using _traits = make_traits; + using _traits = make_traits; using _cpp_value_type = int64_t; template diff --git a/include/sqlpp11/data_types/text/data_type.h b/include/sqlpp11/data_types/text/data_type.h index 7356342d..7b90b5e0 100644 --- a/include/sqlpp11/data_types/text/data_type.h +++ b/include/sqlpp11/data_types/text/data_type.h @@ -33,7 +33,7 @@ namespace sqlpp { struct text { - using _traits = make_traits; + using _traits = make_traits; using _cpp_value_type = std::string; template diff --git a/include/sqlpp11/data_types/time_point/data_type.h b/include/sqlpp11/data_types/time_point/data_type.h index 89e02619..f4507a03 100644 --- a/include/sqlpp11/data_types/time_point/data_type.h +++ b/include/sqlpp11/data_types/time_point/data_type.h @@ -34,7 +34,7 @@ namespace sqlpp { struct time_point { - using _traits = make_traits; + using _traits = make_traits; using _cpp_value_type = ::sqlpp::chrono::mus_point; template diff --git a/include/sqlpp11/expression_return_types.h b/include/sqlpp11/expression_return_types.h index 7b2a27af..43f31ae4 100644 --- a/include/sqlpp11/expression_return_types.h +++ b/include/sqlpp11/expression_return_types.h @@ -51,15 +51,15 @@ namespace sqlpp template using return_type_or_t = typename return_type_or::type; - template + template struct return_type_not { using check = assert_valid_operands; using type = bad_expression; }; - template - using return_type_not_t = typename return_type_not::type; + template + using return_type_not_t = typename return_type_not::type; } #endif diff --git a/tests/BooleanExpression.cpp b/tests/BooleanExpression.cpp index c3b9daa1..ad1b668d 100644 --- a/tests/BooleanExpression.cpp +++ b/tests/BooleanExpression.cpp @@ -35,7 +35,7 @@ int BooleanExpression(int, char**) auto x = boolean_expression(db, not(t.alpha == 7)); x = sqlpp::boolean_expression(t.beta.like("%cheesecake")); - x = false or (x and boolean_expression(db, t.gamma)); + x = x and boolean_expression(db, t.gamma); db(select(t.alpha).from(t).where(x));