mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
A bit of cleanup
This commit is contained in:
parent
e1ec4a8f53
commit
dff0c9942a
@ -28,7 +28,7 @@
|
||||
#define SQLPP_DETAIL_BASIC_EXPRESSION_OPERATORS_H
|
||||
|
||||
#include <sqlpp11/value_type_fwd.h>
|
||||
#include <sqlpp11/bad_statement.h>
|
||||
#include <sqlpp11/bad_expression.h>
|
||||
#include <sqlpp11/portable_static_assert.h>
|
||||
#include <sqlpp11/consistent.h>
|
||||
#include <sqlpp11/alias.h>
|
||||
@ -69,7 +69,7 @@ namespace sqlpp
|
||||
template <bool Enable, template <typename Lhs, typename Rhs> class Expr, typename Lhs, typename Rhs>
|
||||
struct new_binary_expression_impl
|
||||
{
|
||||
using type = bad_statement;
|
||||
using type = bad_expression<boolean>;
|
||||
};
|
||||
|
||||
template <template <typename Lhs, typename Rhs> class Expr, typename Lhs, typename Rhs>
|
||||
@ -86,7 +86,7 @@ namespace sqlpp
|
||||
template <bool Enable, template <typename Lhs, typename... Rhs> class Expr, typename Lhs, typename... Rhs>
|
||||
struct new_nary_expression_impl
|
||||
{
|
||||
using type = bad_statement;
|
||||
using type = bad_expression<boolean>;
|
||||
};
|
||||
|
||||
template <template <typename Lhs, typename... Rhs> class Expr, typename Lhs, typename... Rhs>
|
||||
@ -111,21 +111,10 @@ namespace sqlpp
|
||||
template <template <typename Lhs, typename Rhs> class NewExpr, typename T>
|
||||
using _new_binary_expression_t = typename _new_binary_expression<NewExpr, T>::type;
|
||||
|
||||
// workaround for msvs bug
|
||||
// template <template <typename Lhs, typename... Rhs> class NewExpr, typename... T>
|
||||
// using _new_nary_expression_t =
|
||||
// new_nary_expression_t<logic::all_t<check_comparison_t<
|
||||
// wrap_operand_t<T>>::value...>,
|
||||
// NewExpr,
|
||||
// Expr,
|
||||
// wrap_operand_t<T>...>;
|
||||
template <template <typename Lhs, typename... Rhs> class NewExpr, typename... T>
|
||||
struct _new_nary_expression
|
||||
{
|
||||
using type = new_nary_expression_t<logic::all_t<check_comparison_t<Expr, wrap_operand_t<T>>::value...>,
|
||||
NewExpr,
|
||||
Expr,
|
||||
wrap_operand_t<T>...>;
|
||||
using type = new_nary_expression_t<check_in_t<Expr, wrap_operand_t<T>...>, NewExpr, Expr, wrap_operand_t<T>...>;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@ -202,14 +191,6 @@ namespace sqlpp
|
||||
return {*static_cast<const Expr*>(this)};
|
||||
}
|
||||
|
||||
// Hint: use value_list wrapper for containers...
|
||||
// workaround for msvs bug
|
||||
// template <typename... T>
|
||||
// _new_nary_expression_t<in_t, T...> in(T... t) const
|
||||
// {
|
||||
// check_rhs_in_arguments_t<Expr, wrap_operand_t<T>...>::_();
|
||||
// return {*static_cast<const Expr*>(this), wrap_operand_t<T>{t}...};
|
||||
// }
|
||||
template <typename... T>
|
||||
typename _new_nary_expression<in_t, T...>::type in(T... t) const
|
||||
{
|
||||
@ -217,13 +198,6 @@ namespace sqlpp
|
||||
return {*static_cast<const Expr*>(this), typename wrap_operand<T>::type{t}...};
|
||||
}
|
||||
|
||||
// workaround for msvs bug
|
||||
// template <typename... T>
|
||||
// _new_nary_expression_t<not_in_t, T...> not_in(T... t) const
|
||||
// {
|
||||
// check_rhs_in_arguments_t<Expr, wrap_operand_t<T>...>::_();
|
||||
// return {*static_cast<const Expr*>(this), wrap_operand_t<T>{t}...};
|
||||
// }
|
||||
template <typename... T>
|
||||
typename _new_nary_expression<not_in_t, T...>::type not_in(T... t) const
|
||||
{
|
||||
|
@ -27,6 +27,7 @@
|
||||
#ifndef SQLPP_PRE_JOIN_H
|
||||
#define SQLPP_PRE_JOIN_H
|
||||
|
||||
#include <sqlpp11/bad_statement.h>
|
||||
#include <sqlpp11/join_types.h>
|
||||
#include <sqlpp11/on.h>
|
||||
#include <sqlpp11/noop.h>
|
||||
|
@ -35,6 +35,7 @@ test_compile(join)
|
||||
test_compile(where)
|
||||
test_compile(having)
|
||||
test_compile(insert)
|
||||
test_compile(in)
|
||||
test_compile(date)
|
||||
test_compile(date_time)
|
||||
test_compile(text)
|
||||
|
@ -56,9 +56,9 @@ namespace
|
||||
decltype(t.someDayPoint != operand), decltype(t.someDayPoint >= operand), decltype(t.someDayPoint > operand),
|
||||
decltype(t.someDayPoint.in(operand)), decltype(t.someDayPoint.in(operand, operand)),
|
||||
decltype(t.someDayPoint.not_in(operand)), decltype(t.someDayPoint.not_in(operand, operand))>;
|
||||
using ExpectedReturnType =
|
||||
sqlpp::logic::all_t<Assert::value xor
|
||||
std::is_same<ReturnType, sqlpp::detail::type_set<sqlpp::bad_statement>>::value>;
|
||||
using ExpectedReturnType = sqlpp::logic::all_t<
|
||||
Assert::value xor
|
||||
std::is_same<ReturnType, sqlpp::detail::type_set<sqlpp::bad_expression<sqlpp::boolean>>>::value>;
|
||||
static_assert(ExpectedReturnType::value, "Unexpected return type");
|
||||
print_type_on_error<ReturnType>(ExpectedReturnType{});
|
||||
}
|
||||
|
@ -56,9 +56,9 @@ namespace
|
||||
decltype(t.someTimePoint != operand), decltype(t.someTimePoint >= operand), decltype(t.someTimePoint > operand),
|
||||
decltype(t.someTimePoint.in(operand)), decltype(t.someTimePoint.in(operand, operand)),
|
||||
decltype(t.someTimePoint.not_in(operand)), decltype(t.someTimePoint.not_in(operand, operand))>;
|
||||
using ExpectedReturnType =
|
||||
sqlpp::logic::all_t<Assert::value xor
|
||||
std::is_same<ReturnType, sqlpp::detail::type_set<sqlpp::bad_statement>>::value>;
|
||||
using ExpectedReturnType = sqlpp::logic::all_t<
|
||||
Assert::value xor
|
||||
std::is_same<ReturnType, sqlpp::detail::type_set<sqlpp::bad_expression<sqlpp::boolean>>>::value>;
|
||||
static_assert(ExpectedReturnType::value, "Unexpected return type");
|
||||
print_type_on_error<ReturnType>(ExpectedReturnType{});
|
||||
}
|
||||
|
@ -54,9 +54,9 @@ namespace
|
||||
using ReturnType = sqlpp::detail::make_type_set_t<decltype(operand < operand), decltype(operand <= operand),
|
||||
decltype(operand == operand), decltype(operand != operand),
|
||||
decltype(operand >= operand), decltype(operand > operand)>;
|
||||
using ExpectedReturnType =
|
||||
sqlpp::logic::all_t<Assert::value xor
|
||||
std::is_same<ReturnType, sqlpp::detail::type_set<sqlpp::bad_statement>>::value>;
|
||||
using ExpectedReturnType = sqlpp::logic::all_t<
|
||||
Assert::value xor
|
||||
std::is_same<ReturnType, sqlpp::detail::type_set<sqlpp::bad_expression<sqlpp::boolean>>>::value>;
|
||||
static_assert(ExpectedReturnType::value, "Unexpected return type");
|
||||
print_type_on_error<ReturnType>(ExpectedReturnType{});
|
||||
}
|
||||
|
@ -56,9 +56,9 @@ namespace
|
||||
decltype(t.someString != operand), decltype(t.someString >= operand), decltype(t.someString > operand),
|
||||
decltype(t.someString.in(operand)), decltype(t.someString.in(operand, operand)),
|
||||
decltype(t.someString.not_in(operand)), decltype(t.someString.not_in(operand, operand))>;
|
||||
using ExpectedReturnType =
|
||||
sqlpp::logic::all_t<Assert::value xor
|
||||
std::is_same<ReturnType, sqlpp::detail::type_set<sqlpp::bad_statement>>::value>;
|
||||
using ExpectedReturnType = sqlpp::logic::all_t<
|
||||
Assert::value xor
|
||||
std::is_same<ReturnType, sqlpp::detail::type_set<sqlpp::bad_expression<sqlpp::boolean>>>::value>;
|
||||
static_assert(ExpectedReturnType::value, "Unexpected return type");
|
||||
print_type_on_error<ReturnType>(ExpectedReturnType{});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user