mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-01-05 12:40:40 -06:00
Cleaned up minor as() method mess plus some oversights
This commit is contained in:
@@ -34,7 +34,8 @@ namespace sqlpp
|
||||
namespace vendor
|
||||
{
|
||||
template<typename Flag, typename Expr>
|
||||
struct avg_t: public floating_point::template expression_operators<avg_t<Flag, Expr>>
|
||||
struct avg_t: public floating_point::template expression_operators<avg_t<Flag, Expr>>,
|
||||
public alias_operators<avg_t<Flag, Expr>>
|
||||
{
|
||||
using _traits = make_traits<floating_point, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||
using _recursive_traits = make_recursive_traits<Expr>;
|
||||
|
||||
@@ -139,7 +139,11 @@ namespace sqlpp
|
||||
static_assert(detail::all_t<_is_valid_comparison_operand<vendor::wrap_operand_t<T>>::value...>::value, "at least one operand of in() is not valid");
|
||||
return { *static_cast<const Base*>(this), vendor::wrap_operand_t<T>{t}... };
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Base>
|
||||
struct alias_operators
|
||||
{
|
||||
template<typename alias_provider>
|
||||
expression_alias_t<Base, alias_provider> as(const alias_provider&)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,8 @@ namespace sqlpp
|
||||
namespace vendor
|
||||
{
|
||||
template<typename Flag, typename Expr>
|
||||
struct count_t: public sqlpp::detail::integral::template expression_operators<count_t<Flag, Expr>>
|
||||
struct count_t: public sqlpp::detail::integral::template expression_operators<count_t<Flag, Expr>>,
|
||||
public alias_operators<count_t<Flag, Expr>>
|
||||
{
|
||||
using _traits = make_traits<::sqlpp::detail::integral, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||
using _recursive_traits = make_recursive_traits<Expr>;
|
||||
|
||||
@@ -34,7 +34,8 @@ namespace sqlpp
|
||||
namespace vendor
|
||||
{
|
||||
template<typename Select>
|
||||
struct exists_t: public boolean::template expression_operators<exists_t<Select>>
|
||||
struct exists_t: public boolean::template expression_operators<exists_t<Select>>,
|
||||
public alias_operators<exists_t<Select>>
|
||||
{
|
||||
using _traits = make_traits<boolean, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||
using _recursive_traits = make_recursive_traits<Select>;
|
||||
|
||||
@@ -55,7 +55,8 @@ namespace sqlpp
|
||||
}
|
||||
|
||||
template<typename ValueType> // Csaba Csoma suggests: unsafe_sql instead of verbatim
|
||||
struct verbatim_t: public ValueType::template expression_operators<verbatim_t<ValueType>>
|
||||
struct verbatim_t: public ValueType::template expression_operators<verbatim_t<ValueType>>,
|
||||
public alias_operators<verbatim_t<ValueType>>
|
||||
{
|
||||
using _traits = make_traits<ValueType, ::sqlpp::tag::expression>;
|
||||
using _recursive_traits = make_recursive_traits<>;
|
||||
|
||||
@@ -34,7 +34,8 @@ namespace sqlpp
|
||||
namespace vendor
|
||||
{
|
||||
template<typename Expr>
|
||||
struct max_t: public value_type_of<Expr>::template expression_operators<max_t<Expr>>
|
||||
struct max_t: public value_type_of<Expr>::template expression_operators<max_t<Expr>>,
|
||||
public alias_operators<max_t<Expr>>
|
||||
{
|
||||
using _traits = make_traits<value_type_of<Expr>, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||
using _recursive_traits = make_recursive_traits<Expr>;
|
||||
|
||||
@@ -34,7 +34,8 @@ namespace sqlpp
|
||||
namespace vendor
|
||||
{
|
||||
template<typename Expr>
|
||||
struct min_t: public value_type_of<Expr>::template expression_operators<min_t<Expr>>
|
||||
struct min_t: public value_type_of<Expr>::template expression_operators<min_t<Expr>>,
|
||||
public alias_operators<min_t<Expr>>
|
||||
{
|
||||
using _traits = make_traits<value_type_of<Expr>, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||
using _recursive_traits = make_recursive_traits<Expr>;
|
||||
|
||||
@@ -186,13 +186,14 @@ namespace sqlpp
|
||||
struct serializer_t<Context, select_t<Database, Policies...>>
|
||||
{
|
||||
using T = select_t<Database, Policies...>;
|
||||
using P = ::sqlpp::detail::select_policies_t<Database, Policies...>;
|
||||
|
||||
static Context& _(const T& t, Context& context)
|
||||
{
|
||||
context << "SELECT ";
|
||||
|
||||
using swallow = int[];
|
||||
(void) swallow{(serialize(static_cast<const Policies&>(t)._data, context), 0)...};
|
||||
(void) swallow{(serialize(static_cast<const typename Policies::template _member_t<P>&>(t)()._data, context), 0)...};
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,8 @@ namespace sqlpp
|
||||
namespace vendor
|
||||
{
|
||||
template<typename Flag, typename Expr>
|
||||
struct sum_t: public value_type_of<Expr>::template expression_operators<sum_t<Flag, Expr>>
|
||||
struct sum_t: public value_type_of<Expr>::template expression_operators<sum_t<Flag, Expr>>,
|
||||
public alias_operators<sum_t<Flag, Expr>>
|
||||
{
|
||||
using _traits = make_traits<value_type_of<Expr>, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||
using _recursive_traits = make_recursive_traits<Expr>;
|
||||
|
||||
3
include/sqlpp11/vendor/concat.h
vendored
3
include/sqlpp11/vendor/concat.h
vendored
@@ -37,7 +37,8 @@ namespace sqlpp
|
||||
{
|
||||
// FIXME: Remove First, inherit from text_t
|
||||
template<typename First, typename... Args>
|
||||
struct concat_t: public value_type_of<First>::template expression_operators<concat_t<First, Args...>>
|
||||
struct concat_t: public value_type_of<First>::template expression_operators<concat_t<First, Args...>>,
|
||||
public alias_operators<concat_t<First, Args...>>
|
||||
{
|
||||
using _traits = make_traits<value_type_of<First>, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||
using _recursive_traits = make_recursive_traits<First, Args...>;
|
||||
|
||||
15
include/sqlpp11/vendor/expression.h
vendored
15
include/sqlpp11/vendor/expression.h
vendored
@@ -40,7 +40,8 @@ namespace sqlpp
|
||||
namespace vendor
|
||||
{
|
||||
template<typename Lhs, typename Rhs>
|
||||
struct binary_expression_t<Lhs, op::equal_to, Rhs>: public ::sqlpp::detail::boolean::template expression_operators<equal_to_t<Lhs, Rhs>>
|
||||
struct binary_expression_t<Lhs, op::equal_to, Rhs>: public ::sqlpp::detail::boolean::template expression_operators<binary_expression_t<Lhs, op::equal_to, Rhs>>,
|
||||
public alias_operators<binary_expression_t<Lhs, op::equal_to, Rhs>>
|
||||
{
|
||||
using _traits = make_traits<boolean, sqlpp::tag::expression>;
|
||||
using _recursive_traits = make_recursive_traits<Lhs, Rhs>;
|
||||
@@ -84,7 +85,8 @@ namespace sqlpp
|
||||
};
|
||||
|
||||
template<typename Lhs, typename Rhs>
|
||||
struct binary_expression_t<Lhs, op::not_equal_to, Rhs>: public ::sqlpp::detail::boolean::template expression_operators<not_equal_to_t<Lhs, Rhs>>
|
||||
struct binary_expression_t<Lhs, op::not_equal_to, Rhs>: public ::sqlpp::detail::boolean::template expression_operators<binary_expression_t<Lhs, op::not_equal_to, Rhs>>,
|
||||
public alias_operators<binary_expression_t<Lhs, op::not_equal_to, Rhs>>
|
||||
{
|
||||
using _traits = make_traits<boolean, sqlpp::tag::expression>;
|
||||
using _recursive_traits = make_recursive_traits<Lhs, Rhs>;
|
||||
@@ -128,7 +130,8 @@ namespace sqlpp
|
||||
};
|
||||
|
||||
template<typename Rhs>
|
||||
struct unary_expression_t<op::logical_not, Rhs>: public ::sqlpp::detail::boolean::template expression_operators<logical_not_t<Rhs>>
|
||||
struct unary_expression_t<op::logical_not, Rhs>: public ::sqlpp::detail::boolean::template expression_operators<unary_expression_t<op::logical_not, Rhs>>,
|
||||
public alias_operators<unary_expression_t<op::logical_not, Rhs>>
|
||||
{
|
||||
using _traits = make_traits<boolean, sqlpp::tag::expression>;
|
||||
using _recursive_traits = make_recursive_traits<Rhs>;
|
||||
@@ -162,7 +165,8 @@ namespace sqlpp
|
||||
};
|
||||
|
||||
template<typename Lhs, typename O, typename Rhs>
|
||||
struct binary_expression_t: public value_type_of<O>::template expression_operators<binary_expression_t<Lhs, O, Rhs>>
|
||||
struct binary_expression_t: public value_type_of<O>::template expression_operators<binary_expression_t<Lhs, O, Rhs>>,
|
||||
public alias_operators<binary_expression_t<Lhs, O, Rhs>>
|
||||
{
|
||||
using _traits = make_traits<value_type_of<O>, sqlpp::tag::expression>;
|
||||
using _recursive_traits = make_recursive_traits<Lhs, Rhs>;
|
||||
@@ -199,7 +203,8 @@ namespace sqlpp
|
||||
};
|
||||
|
||||
template<typename O, typename Rhs>
|
||||
struct unary_expression_t: public O::_value_type::template expression_operators<unary_expression_t<O, Rhs>>
|
||||
struct unary_expression_t: public O::_value_type::template expression_operators<unary_expression_t<O, Rhs>>,
|
||||
public alias_operators<unary_expression_t<O, Rhs>>
|
||||
{
|
||||
using _traits = make_traits<value_type_of<O>, sqlpp::tag::expression>;
|
||||
using _recursive_traits = make_recursive_traits<Rhs>;
|
||||
|
||||
2
include/sqlpp11/vendor/extra_tables.h
vendored
2
include/sqlpp11/vendor/extra_tables.h
vendored
@@ -156,7 +156,7 @@ namespace sqlpp
|
||||
template<typename Context, typename Database, typename... Tables>
|
||||
struct serializer_t<Context, extra_tables_data_t<Database, Tables...>>
|
||||
{
|
||||
using T = extra_tables_t<Database, Tables...>;
|
||||
using T = extra_tables_data_t<Database, Tables...>;
|
||||
|
||||
static Context& _(const T& t, Context& context)
|
||||
{
|
||||
|
||||
2
include/sqlpp11/vendor/from.h
vendored
2
include/sqlpp11/vendor/from.h
vendored
@@ -191,7 +191,7 @@ namespace sqlpp
|
||||
template<typename Context, typename Database, typename... Tables>
|
||||
struct serializer_t<Context, from_data_t<Database, Tables...>>
|
||||
{
|
||||
using T = from_t<Database, Tables...>;
|
||||
using T = from_data_t<Database, Tables...>;
|
||||
|
||||
static Context& _(const T& t, Context& context)
|
||||
{
|
||||
|
||||
3
include/sqlpp11/vendor/in.h
vendored
3
include/sqlpp11/vendor/in.h
vendored
@@ -37,7 +37,8 @@ namespace sqlpp
|
||||
namespace vendor
|
||||
{
|
||||
template<bool NotInverted, typename Operand, typename... Args>
|
||||
struct in_t: public boolean::template expression_operators<in_t<NotInverted, Operand, Args...>>
|
||||
struct in_t: public boolean::template expression_operators<in_t<NotInverted, Operand, Args...>>,
|
||||
public alias_operators<in_t<NotInverted, Operand, Args...>>
|
||||
{
|
||||
using _traits = make_traits<boolean, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||
using _recursive_traits = make_recursive_traits<Operand, Args...>;
|
||||
|
||||
3
include/sqlpp11/vendor/is_null.h
vendored
3
include/sqlpp11/vendor/is_null.h
vendored
@@ -36,7 +36,8 @@ namespace sqlpp
|
||||
namespace vendor
|
||||
{
|
||||
template<bool NotInverted, typename Operand>
|
||||
struct is_null_t: public boolean::template expression_operators<is_null_t<NotInverted, Operand>>
|
||||
struct is_null_t: public boolean::template expression_operators<is_null_t<NotInverted, Operand>>,
|
||||
public alias_operators<is_null_t<NotInverted, Operand>>
|
||||
{
|
||||
using _traits = make_traits<boolean, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||
using _recursive_traits = make_recursive_traits<Operand>;
|
||||
|
||||
3
include/sqlpp11/vendor/like.h
vendored
3
include/sqlpp11/vendor/like.h
vendored
@@ -36,7 +36,8 @@ namespace sqlpp
|
||||
namespace vendor
|
||||
{
|
||||
template<typename Operand, typename Pattern>
|
||||
struct like_t: public boolean::template expression_operators<like_t<Operand, Pattern>>
|
||||
struct like_t: public boolean::template expression_operators<like_t<Operand, Pattern>>,
|
||||
public alias_operators<like_t<Operand, Pattern>>
|
||||
{
|
||||
using _traits = make_traits<boolean, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>;
|
||||
using _recursive_traits = make_recursive_traits<Operand, Pattern>;
|
||||
|
||||
8
include/sqlpp11/vendor/offset.h
vendored
8
include/sqlpp11/vendor/offset.h
vendored
@@ -237,9 +237,9 @@ namespace sqlpp
|
||||
|
||||
// Interpreters
|
||||
template<typename Context, typename Offset>
|
||||
struct serializer_t<Context, offset_t<Offset>>
|
||||
struct serializer_t<Context, offset_data_t<Offset>>
|
||||
{
|
||||
using T = offset_t<Offset>;
|
||||
using T = offset_data_t<Offset>;
|
||||
|
||||
static Context& _(const T& t, Context& context)
|
||||
{
|
||||
@@ -250,9 +250,9 @@ namespace sqlpp
|
||||
};
|
||||
|
||||
template<typename Context, typename Database>
|
||||
struct serializer_t<Context, dynamic_offset_t<Database>>
|
||||
struct serializer_t<Context, dynamic_offset_data_t<Database>>
|
||||
{
|
||||
using T = dynamic_offset_t<Database>;
|
||||
using T = dynamic_offset_data_t<Database>;
|
||||
|
||||
static Context& _(const T& t, Context& context)
|
||||
{
|
||||
|
||||
2
include/sqlpp11/vendor/select_column_list.h
vendored
2
include/sqlpp11/vendor/select_column_list.h
vendored
@@ -131,6 +131,8 @@ namespace sqlpp
|
||||
template<typename Database, typename... Columns>
|
||||
struct select_column_list_data_t
|
||||
{
|
||||
using _is_dynamic = typename std::conditional<std::is_same<Database, void>::value, std::false_type, std::true_type>::type;
|
||||
|
||||
select_column_list_data_t(Columns... columns):
|
||||
_columns(columns...)
|
||||
{}
|
||||
|
||||
Reference in New Issue
Block a user