diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f033171..f606df00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,14 @@ enable_testing() add_library(sqlpp11 INTERFACE) +set(DATE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../date" CACHE FILEPATH "Path to Howard Hinnant's date library") + +if(NOT EXISTS ${DATE_INCLUDE_DIR}/date.h) + message(SEND_ERROR "Can't find date.h in ${DATE_INCLUDE_DIR}") +endif() + target_include_directories(sqlpp11 INTERFACE + $ $ ) diff --git a/include/sqlpp11/basic_expression_operators.h b/include/sqlpp11/basic_expression_operators.h index 032ecd34..0f60e025 100644 --- a/include/sqlpp11/basic_expression_operators.h +++ b/include/sqlpp11/basic_expression_operators.h @@ -28,6 +28,9 @@ #define SQLPP_DETAIL_BASIC_EXPRESSION_OPERATORS_H #include +#include +#include +#include #include #include #include @@ -38,72 +41,145 @@ namespace sqlpp { + SQLPP_PORTABLE_STATIC_ASSERT(assert_valid_rhs_comparison_operand_t, "invalid rhs operand in comparison"); + + template + using check_rhs_comparison_operand_t = + static_check_t<(is_expression_t>::value // expressions are OK + or + is_multi_expression_t>::value) // multi-expressions like ANY are + // OK for comparisons, too + and + LhsValueType::template _is_valid_operand< + sqlpp::wrap_operand_t>::value, // the correct value type is required, of course + assert_valid_rhs_comparison_operand_t>; + + SQLPP_PORTABLE_STATIC_ASSERT(assert_valid_in_arguments_t, "at least one operand of in() is not valid"); + + template + using check_rhs_in_arguments_t = + static_check_t::value...>::value, + assert_valid_in_arguments_t>; + + namespace detail + { + template class Expr, typename Lhs> + struct new_unary_expression_impl + { + using type = bad_statement; + }; + + template