0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 04:47:18 +08:00

Streamlined type traits a bit

This commit is contained in:
rbock 2014-07-28 06:54:54 +02:00
parent 643aab222e
commit dd33b8096e
59 changed files with 141 additions and 168 deletions

View File

@ -35,7 +35,7 @@ namespace sqlpp
template<typename Expression, typename AliasProvider>
struct expression_alias_t
{
using _traits = make_traits<value_type_of<Expression>, tag::named_expression, tag::alias>;
using _traits = make_traits<value_type_of<Expression>, tag::is_named_expression, tag::is_alias>;
using _recursive_traits = make_recursive_traits<Expression>;
static_assert(is_expression_t<Expression>::value, "invalid argument for an expression alias");

View File

@ -35,7 +35,7 @@ namespace sqlpp
template<typename Select>
struct any_t
{
using _traits = make_traits<value_type_of<Select>, ::sqlpp::tag::multi_expression>;
using _traits = make_traits<value_type_of<Select>, ::sqlpp::tag::is_multi_expression>;
using _recursive_traits = make_recursive_traits<Select>;
struct _name_t

View File

@ -40,7 +40,7 @@ namespace sqlpp
template<typename Lhs, typename Rhs>
struct assignment_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::assignment>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_assignment>;
using _recursive_traits = make_recursive_traits<Lhs, Rhs>;
using _lhs_t = Lhs;

View File

@ -35,7 +35,7 @@ namespace sqlpp
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 _traits = make_traits<floating_point, ::sqlpp::tag::is_expression, ::sqlpp::tag::is_named_expression>;
using _recursive_traits = make_recursive_traits<Expr>;
static_assert(is_noop<Flag>::value or std::is_same<sqlpp::distinct_t, Flag>::value, "avg() used with flag other than 'distinct'");

View File

@ -41,7 +41,7 @@ namespace sqlpp
// boolean value type
struct boolean
{
using _tag = ::sqlpp::tag::boolean;
using _tag = ::sqlpp::tag::is_boolean;
using _cpp_value_type = bool;
struct _parameter_t

View File

@ -48,7 +48,7 @@ namespace sqlpp
struct _traits
{
using _value_type = value_type_of<ColumnSpec>;
using _tags = detail::make_joined_set_t<detail::type_set<tag::column, tag::expression, tag::named_expression>, typename ColumnSpec::_traits::_tags>;
using _tags = detail::make_joined_set_t<detail::type_set<tag::is_column, tag::is_expression, tag::is_named_expression>, typename ColumnSpec::_traits::_tags>;
};
struct _recursive_traits

View File

@ -39,7 +39,7 @@ namespace sqlpp
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 _traits = make_traits<value_type_of<First>, ::sqlpp::tag::is_expression, ::sqlpp::tag::is_named_expression>;
using _recursive_traits = make_recursive_traits<First, Args...>;
static_assert(sizeof...(Args) > 0, "concat requires two arguments at least");

View File

@ -36,7 +36,7 @@ namespace sqlpp
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 _traits = make_traits<::sqlpp::detail::integral, ::sqlpp::tag::is_expression, ::sqlpp::tag::is_named_expression>;
using _recursive_traits = make_recursive_traits<Expr>;
static_assert(is_noop<Flag>::value or std::is_same<sqlpp::distinct_t, Flag>::value, "count() used with flag other than 'distinct'");

View File

@ -33,7 +33,7 @@ namespace sqlpp
{
struct default_value_t
{
using _traits = make_traits<no_value_t, tag::expression>;
using _traits = make_traits<no_value_t, tag::is_expression>;
using _recursive_traits = make_recursive_traits<>;
static constexpr bool _is_trivial() { return false; }

View File

@ -35,7 +35,7 @@ namespace sqlpp
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 _traits = make_traits<boolean, ::sqlpp::tag::is_expression, ::sqlpp::tag::is_named_expression>;
using _recursive_traits = make_recursive_traits<Select>;
static_assert(is_select_t<Select>::value, "exists() requires a select expression as argument");

View File

@ -41,7 +41,7 @@ namespace sqlpp
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 _traits = make_traits<boolean, sqlpp::tag::is_expression>;
using _recursive_traits = make_recursive_traits<Lhs, Rhs>;
using _lhs_t = Lhs;
using _rhs_t = allow_tvin_t<Rhs>;
@ -88,7 +88,7 @@ namespace sqlpp
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 _traits = make_traits<boolean, sqlpp::tag::is_expression>;
using _recursive_traits = make_recursive_traits<Lhs, Rhs>;
using _lhs_t = Lhs;
using _rhs_t = allow_tvin_t<Rhs>;
@ -135,7 +135,7 @@ namespace sqlpp
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 _traits = make_traits<boolean, sqlpp::tag::is_expression>;
using _recursive_traits = make_recursive_traits<Rhs>;
unary_expression_t(Rhs rhs):
@ -177,7 +177,7 @@ namespace sqlpp
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 _traits = make_traits<value_type_of<O>, sqlpp::tag::is_expression>;
using _recursive_traits = make_recursive_traits<Lhs, Rhs>;
binary_expression_t(Lhs lhs, Rhs rhs):
@ -215,7 +215,7 @@ namespace sqlpp
struct unary_expression_t: public value_type_of<O>::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 _traits = make_traits<value_type_of<O>, sqlpp::tag::is_expression>;
using _recursive_traits = make_recursive_traits<Rhs>;
unary_expression_t(Rhs rhs):

View File

@ -51,7 +51,7 @@ namespace sqlpp
template<typename... Tables>
struct extra_tables_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::extra_tables>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_extra_tables>;
struct _recursive_traits
{
using _parameters = std::tuple<>;
@ -106,7 +106,7 @@ namespace sqlpp
// NO EXTRA TABLES YET
struct no_extra_tables_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_noop>;
using _recursive_traits = make_recursive_traits<>;
// Data

View File

@ -34,7 +34,7 @@ namespace sqlpp
template<typename NameType, typename ValueType, bool CanBeNull, bool NullIsTrivialValue>
struct field_spec_t
{
using _traits = make_traits<ValueType, tag::noop,
using _traits = make_traits<ValueType, tag::is_noop,
typename std::conditional<CanBeNull, tag::can_be_null, void>::type,
typename std::conditional<NullIsTrivialValue, tag::null_is_trivial_value, void>::type
>;

View File

@ -40,7 +40,7 @@ namespace sqlpp
// floating_point value type
struct floating_point
{
using _tag = ::sqlpp::tag::floating_point;
using _tag = ::sqlpp::tag::is_floating_point;
using _cpp_value_type = double;
struct _parameter_t

View File

@ -59,7 +59,7 @@ namespace sqlpp
template<typename Database, typename... Tables>
struct from_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::from>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_from>;
using _recursive_traits = make_recursive_traits<Tables...>;
using _is_dynamic = is_database<Database>;
@ -125,7 +125,7 @@ namespace sqlpp
struct no_from_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_noop>;
using _recursive_traits = make_recursive_traits<>;
// Data

View File

@ -56,7 +56,7 @@ namespace sqlpp
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 _traits = make_traits<ValueType, ::sqlpp::tag::is_expression>;
struct _recursive_traits : public make_recursive_traits<>
{
using _can_be_null = std::true_type; // since we do not know what's going on inside the verbatim, we assume it can be null
@ -102,7 +102,7 @@ namespace sqlpp
template<typename Container>
struct value_list_t // to be used in .in() method
{
using _traits = make_traits<value_type_t<typename Container::value_type>, ::sqlpp::tag::expression>;
using _traits = make_traits<value_type_t<typename Container::value_type>, ::sqlpp::tag::is_expression>;
using _recursive_traits = make_recursive_traits<>;
using _container_t = Container;

View File

@ -59,7 +59,7 @@ namespace sqlpp
template<typename Database, typename... Expressions>
struct group_by_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::group_by>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_group_by>;
using _recursive_traits = make_recursive_traits<Expressions...>;
using _is_dynamic = is_database<Database>;
@ -135,7 +135,7 @@ namespace sqlpp
// NO GROUP BY YET
struct no_group_by_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_noop>;
using _recursive_traits = make_recursive_traits<>;
// Data

View File

@ -58,7 +58,7 @@ namespace sqlpp
template<typename Database, typename... Expressions>
struct having_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::having>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_having>;
using _recursive_traits = make_recursive_traits<Expressions...>;
using _is_dynamic = is_database<Database>;
@ -133,7 +133,7 @@ namespace sqlpp
// NO HAVING YET
struct no_having_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_noop>;
using _recursive_traits = make_recursive_traits<>;
// Data

View File

@ -38,7 +38,7 @@ namespace sqlpp
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 _traits = make_traits<boolean, ::sqlpp::tag::is_expression, ::sqlpp::tag::is_named_expression>;
using _recursive_traits = make_recursive_traits<Operand, Args...>;
static constexpr bool _inverted = not NotInverted;

View File

@ -42,7 +42,7 @@ namespace sqlpp
struct insert_t: public statement_name_t<insert_name_t>
{
using _traits = make_traits<no_value_t, tag::return_value>;
using _traits = make_traits<no_value_t, tag::is_return_value>;
struct _name_t {};
template<typename Policies>

View File

@ -49,7 +49,7 @@ namespace sqlpp
{
struct type
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_noop>;
using _recursive_traits = make_recursive_traits<>;
};
};

View File

@ -106,7 +106,7 @@ namespace sqlpp
template<typename Database, typename... Assignments>
struct insert_list_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::insert_list>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_insert_list>;
using _recursive_traits = make_recursive_traits<typename Assignments::_lhs_t..., typename Assignments::_rhs_t...>;
using _is_dynamic = is_database<Database>;
@ -207,7 +207,7 @@ namespace sqlpp
template<typename... Columns>
struct column_list_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::column_list>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_column_list>;
using _recursive_traits = make_recursive_traits<Columns...>;
static_assert(sizeof...(Columns), "at least one column required in columns()");
@ -285,7 +285,7 @@ namespace sqlpp
// NO INSERT COLUMNS/VALUES YET
struct no_insert_value_list_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_noop>;
using _recursive_traits = make_recursive_traits<>;
// Data

View File

@ -42,8 +42,8 @@ namespace sqlpp
// integral value type
struct integral
{
using _traits = make_traits<integral, ::sqlpp::tag::expression>;
using _tag = ::sqlpp::tag::integral;
using _traits = make_traits<integral, ::sqlpp::tag::is_expression>;
using _tag = ::sqlpp::tag::is_integral;
using _cpp_value_type = int64_t;
struct _parameter_t

View File

@ -57,7 +57,7 @@ namespace sqlpp
template<typename Database, typename Table>
struct into_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::into>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_into>;
using _recursive_traits = make_recursive_traits<Table>;
static_assert(is_table_t<Table>::value, "argument has to be a table");
@ -103,7 +103,7 @@ namespace sqlpp
// NO INTO YET
struct no_into_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_noop>;
using _recursive_traits = make_recursive_traits<>;
// Data

View File

@ -37,7 +37,7 @@ namespace sqlpp
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 _traits = make_traits<boolean, ::sqlpp::tag::is_expression, ::sqlpp::tag::is_named_expression>;
using _recursive_traits = make_recursive_traits<Operand>;
static constexpr bool _inverted = not NotInverted;

View File

@ -65,7 +65,7 @@ namespace sqlpp
template<typename JoinType, typename Lhs, typename Rhs, typename On = noop>
struct join_t
{
using _traits = make_traits<no_value_t, tag::table, tag::join>;
using _traits = make_traits<no_value_t, tag::is_table, tag::is_join>;
struct _recursive_traits
{
using _required_tables = detail::make_joined_set_t<required_tables_of<Lhs>, required_tables_of<Rhs>>;

View File

@ -37,7 +37,7 @@ namespace sqlpp
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 _traits = make_traits<boolean, ::sqlpp::tag::is_expression, ::sqlpp::tag::is_named_expression>;
using _recursive_traits = make_recursive_traits<Operand, Pattern>;
static_assert(is_text_t<Operand>::value, "Operand for like() has to be a text");

View File

@ -54,7 +54,7 @@ namespace sqlpp
template<typename Limit>
struct limit_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::limit>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_limit>;
using _recursive_traits = make_recursive_traits<Limit>;
static_assert(is_integral_t<Limit>::value, "limit requires an integral value or integral parameter");
@ -123,7 +123,7 @@ namespace sqlpp
template<typename Database>
struct dynamic_limit_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::limit>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_limit>;
using _recursive_traits = make_recursive_traits<>;
// Data
@ -172,7 +172,7 @@ namespace sqlpp
struct no_limit_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_noop>;
using _recursive_traits = make_recursive_traits<>;
// Data

View File

@ -35,7 +35,7 @@ namespace sqlpp
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 _traits = make_traits<value_type_of<Expr>, ::sqlpp::tag::is_expression, ::sqlpp::tag::is_named_expression>;
using _recursive_traits = make_recursive_traits<Expr>;
static_assert(is_expression_t<Expr>::value, "max() requires a value expression as argument");

View File

@ -35,7 +35,7 @@ namespace sqlpp
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 _traits = make_traits<value_type_of<Expr>, ::sqlpp::tag::is_expression, ::sqlpp::tag::is_named_expression>;
using _recursive_traits = make_recursive_traits<Expr>;
static_assert(is_expression_t<Expr>::value, "min() requires a value expression as argument");

View File

@ -76,7 +76,7 @@ namespace sqlpp
template<typename AliasProvider, typename... Columns>
struct multi_column_alias_t
{
using _traits = make_traits<no_value_t, tag::alias, tag::multi_column, tag::named_expression>;
using _traits = make_traits<no_value_t, tag::is_alias, tag::is_multi_column, tag::is_named_expression>;
using _recursive_traits = make_recursive_traits<Columns...>;
static_assert(detail::all_t<is_named_expression_t<Columns>::value...>::value, "multi_column parameters need to be named expressions");

View File

@ -35,7 +35,7 @@ namespace sqlpp
{
struct noop
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_noop>;
using _recursive_traits = make_recursive_traits<>;
struct _name_t {};

View File

@ -33,7 +33,7 @@ namespace sqlpp
{
struct null_t
{
using _traits = make_traits<no_value_t, tag::expression>;
using _traits = make_traits<no_value_t, tag::is_expression>;
using _recursive_traits = make_recursive_traits<>;
};

View File

@ -54,7 +54,7 @@ namespace sqlpp
template<typename Offset>
struct offset_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::offset>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_offset>;
using _recursive_traits = make_recursive_traits<Offset>;
static_assert(is_integral_t<Offset>::value, "offset requires an integral value or integral parameter");
@ -123,7 +123,7 @@ namespace sqlpp
template<typename Database>
struct dynamic_offset_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::offset>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_offset>;
using _recursive_traits = make_recursive_traits<>;
// Data
@ -183,7 +183,7 @@ namespace sqlpp
struct no_offset_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_noop>;
using _recursive_traits = make_recursive_traits<>;
// Data

View File

@ -37,7 +37,7 @@ namespace sqlpp
template<typename Database, typename... Expr>
struct on_t
{
using _traits = make_traits<no_value_t, tag::on>;
using _traits = make_traits<no_value_t, tag::is_on>;
using _recursive_traits = make_recursive_traits<Expr...>;
using _is_dynamic = is_database<Database>;

View File

@ -59,7 +59,7 @@ namespace sqlpp
template<typename Database, typename... Expressions>
struct order_by_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::order_by>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_order_by>;
using _recursive_traits = make_recursive_traits<Expressions...>;
using _is_dynamic = is_database<Database>;
@ -135,7 +135,7 @@ namespace sqlpp
// NO ORDER BY YET
struct no_order_by_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_noop>;
using _recursive_traits = make_recursive_traits<>;
// Data

View File

@ -36,7 +36,7 @@ namespace sqlpp
template<typename ValueType, typename NameType>
struct parameter_t: public ValueType::template expression_operators<parameter_t<ValueType, NameType>>
{
using _traits = make_traits<ValueType, tag::parameter, tag::expression>;
using _traits = make_traits<ValueType, tag::is_parameter, tag::is_expression>;
struct _recursive_traits
{
using _parameters = std::tuple<parameter_t>;

View File

@ -42,7 +42,7 @@ namespace sqlpp
struct remove_name_t {};
struct remove_t: public statement_name_t<remove_name_t>
{
using _traits = make_traits<no_value_t, tag::return_value>;
using _traits = make_traits<no_value_t, tag::is_return_value>;
struct _name_t {};
template<typename Policies>

View File

@ -184,7 +184,7 @@ namespace sqlpp
using _impl = detail::result_row_impl<Db, detail::make_column_index_sequence<0, FieldSpecs...>, FieldSpecs...>;
struct _field_spec_t
{
using _traits = make_traits<detail::text, tag::noop, tag::can_be_null, tag::null_is_trivial_value>;
using _traits = make_traits<detail::text, tag::is_noop, tag::can_be_null, tag::null_is_trivial_value>;
using _recursive_traits = make_recursive_traits<>;
struct _name_t {};

View File

@ -47,14 +47,14 @@ namespace sqlpp
template<typename... Columns>
struct select_traits
{
using _traits = make_traits<no_value_t, tag::select_column_list, tag::return_value>;
using _traits = make_traits<no_value_t, tag::is_select_column_list, tag::is_return_value>;
struct _name_t {};
};
template<typename Column>
struct select_traits<Column>
{
using _traits = make_traits<value_type_of<Column>, tag::select_column_list, tag::return_value, tag::expression, tag::named_expression>;
using _traits = make_traits<value_type_of<Column>, tag::is_select_column_list, tag::is_return_value, tag::is_expression, tag::is_named_expression>;
using _name_t = typename Column::_name_t;
};
}
@ -326,7 +326,7 @@ namespace sqlpp
struct no_select_column_list_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop, ::sqlpp::tag::missing>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_noop, ::sqlpp::tag::is_missing>;
using _recursive_traits = make_recursive_traits<>;
struct _name_t {};

View File

@ -59,7 +59,7 @@ namespace sqlpp
template<typename Database, typename... Flags>
struct select_flag_list_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::select_flag_list>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_select_flag_list>;
using _recursive_traits = make_recursive_traits<Flags...>;
using _is_dynamic = is_database<Database>;
@ -134,7 +134,7 @@ namespace sqlpp
struct no_select_flag_list_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_noop>;
using _recursive_traits = make_recursive_traits<>;
// Data

View File

@ -37,7 +37,7 @@ namespace sqlpp
// standard select flags
struct all_t
{
using _traits = make_traits<no_value_t, tag::select_flag>;
using _traits = make_traits<no_value_t, tag::is_select_flag>;
using _recursive_traits = make_recursive_traits<>;
};
static constexpr all_t all = {};
@ -54,7 +54,7 @@ namespace sqlpp
struct distinct_t
{
using _traits = make_traits<no_value_t, tag::select_flag>;
using _traits = make_traits<no_value_t, tag::is_select_flag>;
using _recursive_traits = make_recursive_traits<>;
};
static constexpr distinct_t distinct = {};
@ -71,7 +71,7 @@ namespace sqlpp
struct straight_join_t
{
using _traits = make_traits<no_value_t, tag::select_flag>;
using _traits = make_traits<no_value_t, tag::is_select_flag>;
using _recursive_traits = make_recursive_traits<>;
};
static constexpr straight_join_t straight_join = {};

View File

@ -55,7 +55,7 @@ namespace sqlpp
Select,
NamedExpr...>, select_column_spec_t<Select, NamedExpr>...>
{
using _traits = make_traits<no_value_t, tag::table, tag::pseudo_table>;
using _traits = make_traits<no_value_t, tag::is_table, tag::is_pseudo_table>;
using _recursive_traits = make_recursive_traits<>;
select_pseudo_table_t(Select select):

View File

@ -37,7 +37,7 @@ namespace sqlpp
{
Column _column;
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_noop>;
using _recursive_traits = make_recursive_traits<>;
};

View File

@ -57,7 +57,7 @@ namespace sqlpp
template<typename Database, typename Table>
struct single_table_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::single_table>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_single_table>;
using _recursive_traits = make_recursive_traits<Table>;
static_assert(is_table_t<Table>::value, "argument has to be a table");
@ -103,7 +103,7 @@ namespace sqlpp
// NO INTO YET
struct no_single_table_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_noop>;
using _recursive_traits = make_recursive_traits<>;
// Data

View File

@ -35,7 +35,7 @@ namespace sqlpp
template<typename Select>
struct some_t
{
using _traits = make_traits<value_type_of<Select>, ::sqlpp::tag::multi_expression>;
using _traits = make_traits<value_type_of<Select>, ::sqlpp::tag::is_multi_expression>;
using _recursive_traits = make_recursive_traits<Select>;
struct _name_t

View File

@ -41,7 +41,7 @@ namespace sqlpp
template<typename Expression, sort_type SortType>
struct sort_order_t
{
using _traits = make_traits<no_value_t, tag::sort_order, sqlpp::tag::expression>;
using _traits = make_traits<no_value_t, tag::is_sort_order, sqlpp::tag::is_expression>;
using _recursive_traits = make_recursive_traits<Expression>;
Expression _expression;

View File

@ -134,16 +134,15 @@ namespace sqlpp
using _policies_t = typename detail::statement_policies_t<Db, Policies...>;
using _traits = make_traits<value_type_of<_policies_t>,
::sqlpp::tag::select,
tag::expression_if<typename _policies_t::_is_expression>,
tag::named_expression_if<typename _policies_t::_is_expression>>;
::sqlpp::tag::is_select,
tag::is_expression_if<typename _policies_t::_is_expression>,
tag::is_named_expression_if<typename _policies_t::_is_expression>,
tag::requires_braces>;
using _recursive_traits = typename _policies_t::_recursive_traits;
using _used_outer_tables = typename _policies_t::_all_provided_outer_tables;
using _result_type_provider = typename _policies_t::_result_type_provider;
using _requires_braces = std::true_type;
using _name_t = typename _result_type_provider::_name_t;
// Constructors
@ -204,7 +203,7 @@ namespace sqlpp
template<typename NameData>
struct statement_name_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::noop>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_noop>;
using _recursive_traits = make_recursive_traits<>;
// Data

View File

@ -35,7 +35,7 @@ namespace sqlpp
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 _traits = make_traits<value_type_of<Expr>, ::sqlpp::tag::is_expression, ::sqlpp::tag::is_named_expression>;
using _recursive_traits = make_recursive_traits<Expr>;
static_assert(is_noop<Flag>::value or std::is_same<sqlpp::distinct_t, Flag>::value, "sum() used with flag other than 'distinct'");

View File

@ -42,7 +42,7 @@ namespace sqlpp
template<typename Table, typename... ColumnSpec>
struct table_t: public table_base_t, public ColumnSpec::_name_t::template _member_t<column_t<Table, ColumnSpec>>...
{
using _traits = make_traits<no_value_t, tag::table>;
using _traits = make_traits<no_value_t, tag::is_table>;
struct _recursive_traits
{

View File

@ -39,7 +39,7 @@ namespace sqlpp
struct table_alias_t: public ColumnSpec::_name_t::template _member_t<column_t<AliasProvider, ColumnSpec>>...
{
//FIXME: Need to add join functionality
using _traits = make_traits<value_type_of<Table>, tag::table, tag::alias, tag::named_expression_if<is_expression_t<Table>>>;
using _traits = make_traits<value_type_of<Table>, tag::is_table, tag::is_alias, tag::is_named_expression_if<is_expression_t<Table>>>;
struct _recursive_traits
{

View File

@ -40,7 +40,7 @@ namespace sqlpp
// text value type
struct text
{
using _tag = ::sqlpp::tag::text;
using _tag = ::sqlpp::tag::is_text;
using _cpp_value_type = std::string;
struct _parameter_t

View File

@ -39,7 +39,7 @@ namespace sqlpp
template<typename Operand>
struct tvin_arg_t
{
using _traits = make_traits<value_type_of<Operand>, tag::expression>;
using _traits = make_traits<value_type_of<Operand>, tag::is_expression>;
using _recursive_traits = make_recursive_traits<Operand>;
using _operand_t = Operand;
@ -89,7 +89,7 @@ namespace sqlpp
template<typename Operand>
struct tvin_t
{
using _traits = make_traits<value_type_of<Operand>, tag::expression>;
using _traits = make_traits<value_type_of<Operand>, tag::is_expression>;
using _recursive_traits = make_recursive_traits<Operand>;
using _operand_t = Operand;

View File

@ -71,56 +71,30 @@ namespace sqlpp
template<typename T>\
using name##_t = typename detail::name##_impl<T>::type;
#define SQLPP_IS_VALUE_TRAIT_GENERATOR(name) \
namespace tag\
{\
struct name{};\
};\
namespace detail\
{\
template<typename T, typename Enable = void>\
struct is_##name##_impl { using type = std::false_type; };\
template<typename T>\
struct is_##name##_impl<T, typename std::enable_if<detail::is_element_of<tag::name, typename T::_traits::_tags>::value>::type> { using type = std::true_type; };\
}\
template<typename T>\
using is_##name##_t = typename detail::is_##name##_impl<T>::type;
#define SQLPP_TYPE_TRAIT_GENERATOR(name) \
namespace detail\
{\
template<typename T, typename Enable = void>\
struct name##_impl: std::false_type {};\
template<typename T>\
struct name##_impl<T, typename std::enable_if<std::is_same<typename T::_##name, std::true_type>::value>::type>: std::true_type {};\
}\
template<typename T>\
struct name##_t: detail::name##_impl<T> {};
SQLPP_IS_VALUE_TRAIT_GENERATOR(boolean);
SQLPP_IS_VALUE_TRAIT_GENERATOR(integral);
SQLPP_IS_VALUE_TRAIT_GENERATOR(floating_point);
SQLPP_VALUE_TRAIT_GENERATOR(is_boolean);
SQLPP_VALUE_TRAIT_GENERATOR(is_integral);
SQLPP_VALUE_TRAIT_GENERATOR(is_floating_point);
template<typename T>
using is_numeric_t = detail::any_t<
detail::is_element_of<tag::integral, typename T::_traits::_tags>::value,
detail::is_element_of<tag::floating_point, typename T::_traits::_tags>::value>;
SQLPP_IS_VALUE_TRAIT_GENERATOR(text);
SQLPP_IS_VALUE_TRAIT_GENERATOR(wrapped_value);
SQLPP_IS_VALUE_TRAIT_GENERATOR(expression);
SQLPP_IS_VALUE_TRAIT_GENERATOR(named_expression);
detail::is_element_of<tag::is_integral, typename T::_traits::_tags>::value,
detail::is_element_of<tag::is_floating_point, typename T::_traits::_tags>::value>;
SQLPP_VALUE_TRAIT_GENERATOR(is_text);
SQLPP_VALUE_TRAIT_GENERATOR(is_wrapped_value);
SQLPP_VALUE_TRAIT_GENERATOR(is_expression);
SQLPP_VALUE_TRAIT_GENERATOR(is_named_expression);
namespace tag
{
template<typename C>
using named_expression_if = typename std::conditional<C::value, tag::named_expression, void>::type;
using is_named_expression_if = typename std::conditional<C::value, tag::is_named_expression, void>::type;
}
namespace tag
{
template<typename C>
using expression_if = typename std::conditional<C::value, tag::expression, void>::type;
using is_expression_if = typename std::conditional<C::value, tag::is_expression, void>::type;
}
SQLPP_IS_VALUE_TRAIT_GENERATOR(multi_expression);
SQLPP_IS_VALUE_TRAIT_GENERATOR(alias);
SQLPP_IS_VALUE_TRAIT_GENERATOR(select_flag);
SQLPP_VALUE_TRAIT_GENERATOR(is_multi_expression);
SQLPP_VALUE_TRAIT_GENERATOR(is_alias);
SQLPP_VALUE_TRAIT_GENERATOR(is_select_flag);
SQLPP_VALUE_TRAIT_GENERATOR(must_not_insert);
SQLPP_VALUE_TRAIT_GENERATOR(must_not_update);
@ -128,40 +102,40 @@ namespace sqlpp
SQLPP_VALUE_TRAIT_GENERATOR(trivial_value_is_null);
SQLPP_VALUE_TRAIT_GENERATOR(null_is_trivial_value);
SQLPP_IS_VALUE_TRAIT_GENERATOR(noop);
SQLPP_IS_VALUE_TRAIT_GENERATOR(missing);
SQLPP_IS_VALUE_TRAIT_GENERATOR(return_value);
SQLPP_IS_VALUE_TRAIT_GENERATOR(table);
SQLPP_IS_VALUE_TRAIT_GENERATOR(join);
SQLPP_IS_VALUE_TRAIT_GENERATOR(pseudo_table);
SQLPP_IS_VALUE_TRAIT_GENERATOR(column);
SQLPP_IS_VALUE_TRAIT_GENERATOR(select);
SQLPP_IS_VALUE_TRAIT_GENERATOR(select_flag_list);
SQLPP_IS_VALUE_TRAIT_GENERATOR(select_column_list);
SQLPP_IS_VALUE_TRAIT_GENERATOR(from);
SQLPP_IS_VALUE_TRAIT_GENERATOR(single_table);
SQLPP_IS_VALUE_TRAIT_GENERATOR(into);
SQLPP_IS_VALUE_TRAIT_GENERATOR(extra_tables);
SQLPP_IS_VALUE_TRAIT_GENERATOR(on);
SQLPP_IS_VALUE_TRAIT_GENERATOR(where);
SQLPP_IS_VALUE_TRAIT_GENERATOR(group_by);
SQLPP_IS_VALUE_TRAIT_GENERATOR(having);
SQLPP_IS_VALUE_TRAIT_GENERATOR(order_by);
SQLPP_IS_VALUE_TRAIT_GENERATOR(limit);
SQLPP_IS_VALUE_TRAIT_GENERATOR(offset);
SQLPP_IS_VALUE_TRAIT_GENERATOR(using_);
SQLPP_IS_VALUE_TRAIT_GENERATOR(column_list);
SQLPP_IS_VALUE_TRAIT_GENERATOR(multi_column);
SQLPP_IS_VALUE_TRAIT_GENERATOR(value_list);
SQLPP_IS_VALUE_TRAIT_GENERATOR(assignment);
SQLPP_IS_VALUE_TRAIT_GENERATOR(update_list);
SQLPP_IS_VALUE_TRAIT_GENERATOR(insert_list);
SQLPP_IS_VALUE_TRAIT_GENERATOR(insert_value);
SQLPP_IS_VALUE_TRAIT_GENERATOR(insert_value_list);
SQLPP_IS_VALUE_TRAIT_GENERATOR(sort_order);
SQLPP_IS_VALUE_TRAIT_GENERATOR(parameter);
SQLPP_VALUE_TRAIT_GENERATOR(is_noop);
SQLPP_VALUE_TRAIT_GENERATOR(is_missing);
SQLPP_VALUE_TRAIT_GENERATOR(is_return_value);
SQLPP_VALUE_TRAIT_GENERATOR(is_table);
SQLPP_VALUE_TRAIT_GENERATOR(is_join);
SQLPP_VALUE_TRAIT_GENERATOR(is_pseudo_table);
SQLPP_VALUE_TRAIT_GENERATOR(is_column);
SQLPP_VALUE_TRAIT_GENERATOR(is_select);
SQLPP_VALUE_TRAIT_GENERATOR(is_select_flag_list);
SQLPP_VALUE_TRAIT_GENERATOR(is_select_column_list);
SQLPP_VALUE_TRAIT_GENERATOR(is_from);
SQLPP_VALUE_TRAIT_GENERATOR(is_single_table);
SQLPP_VALUE_TRAIT_GENERATOR(is_into);
SQLPP_VALUE_TRAIT_GENERATOR(is_extra_tables);
SQLPP_VALUE_TRAIT_GENERATOR(is_on);
SQLPP_VALUE_TRAIT_GENERATOR(is_where);
SQLPP_VALUE_TRAIT_GENERATOR(is_group_by);
SQLPP_VALUE_TRAIT_GENERATOR(is_having);
SQLPP_VALUE_TRAIT_GENERATOR(is_order_by);
SQLPP_VALUE_TRAIT_GENERATOR(is_limit);
SQLPP_VALUE_TRAIT_GENERATOR(is_offset);
SQLPP_VALUE_TRAIT_GENERATOR(is_using_);
SQLPP_VALUE_TRAIT_GENERATOR(is_column_list);
SQLPP_VALUE_TRAIT_GENERATOR(is_multi_column);
SQLPP_VALUE_TRAIT_GENERATOR(is_value_list);
SQLPP_VALUE_TRAIT_GENERATOR(is_assignment);
SQLPP_VALUE_TRAIT_GENERATOR(is_update_list);
SQLPP_VALUE_TRAIT_GENERATOR(is_insert_list);
SQLPP_VALUE_TRAIT_GENERATOR(is_insert_value);
SQLPP_VALUE_TRAIT_GENERATOR(is_insert_value_list);
SQLPP_VALUE_TRAIT_GENERATOR(is_sort_order);
SQLPP_VALUE_TRAIT_GENERATOR(is_parameter);
SQLPP_TYPE_TRAIT_GENERATOR(requires_braces);
SQLPP_VALUE_TRAIT_GENERATOR(requires_braces);
SQLPP_VALUE_TRAIT_GENERATOR(enforce_null_result_treatment);

View File

@ -43,7 +43,7 @@ namespace sqlpp
struct update_t: public statement_name_t<update_name_t>
{
using _traits = make_traits<no_value_t, tag::return_value>;
using _traits = make_traits<no_value_t, tag::is_return_value>;
struct _name_t {};
template<typename Policies>

View File

@ -56,7 +56,7 @@ namespace sqlpp
template<typename Database, typename... Assignments>
struct update_list_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::update_list>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_update_list>;
using _recursive_traits = make_recursive_traits<Assignments...>;
using _is_dynamic = is_database<Database>;
@ -130,7 +130,7 @@ namespace sqlpp
struct no_update_list_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::where>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_where>;
using _recursive_traits = make_recursive_traits<>;
// Data

View File

@ -57,7 +57,7 @@ namespace sqlpp
template<typename Database, typename... Tables>
struct using_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::using_>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_using_>;
using _recursive_traits = make_recursive_traits<Tables...>;
using _is_dynamic = is_database<Database>;
@ -128,7 +128,7 @@ namespace sqlpp
// NO USING YET
struct no_using_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::where>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_where>;
using _recursive_traits = make_recursive_traits<>;
// Data

View File

@ -58,7 +58,7 @@ namespace sqlpp
template<typename Database, typename... Expressions>
struct where_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::where>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_where>;
using _recursive_traits = make_recursive_traits<Expressions...>;
using _is_dynamic = is_database<Database>;
@ -141,7 +141,7 @@ namespace sqlpp
template<>
struct where_t<void, bool>
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::where>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_where>;
using _recursive_traits = make_recursive_traits<>;
// Data
@ -184,7 +184,7 @@ namespace sqlpp
template<bool Required>
struct no_where_t
{
using _traits = make_traits<no_value_t, ::sqlpp::tag::where>;
using _traits = make_traits<no_value_t, ::sqlpp::tag::is_where>;
using _recursive_traits = make_recursive_traits<>;
// Data

View File

@ -43,7 +43,7 @@ namespace sqlpp
struct boolean_operand
{
using _traits = make_traits<::sqlpp::detail::boolean, ::sqlpp::tag::expression, ::sqlpp::tag::wrapped_value>;
using _traits = make_traits<::sqlpp::detail::boolean, ::sqlpp::tag::is_expression, ::sqlpp::tag::is_wrapped_value>;
using _recursive_traits = make_recursive_traits<>;
using _value_t = bool;
@ -81,7 +81,7 @@ namespace sqlpp
struct integral_operand
{
using _traits = make_traits<::sqlpp::detail::integral, ::sqlpp::tag::expression, ::sqlpp::tag::wrapped_value>;
using _traits = make_traits<::sqlpp::detail::integral, ::sqlpp::tag::is_expression, ::sqlpp::tag::is_wrapped_value>;
using _recursive_traits = make_recursive_traits<>;
using _value_t = int64_t;
@ -120,7 +120,7 @@ namespace sqlpp
struct floating_point_operand
{
using _traits = make_traits<::sqlpp::detail::floating_point, ::sqlpp::tag::expression, ::sqlpp::tag::wrapped_value>;
using _traits = make_traits<::sqlpp::detail::floating_point, ::sqlpp::tag::is_expression, ::sqlpp::tag::is_wrapped_value>;
using _recursive_traits = make_recursive_traits<>;
using _value_t = double;
@ -158,7 +158,7 @@ namespace sqlpp
struct text_operand
{
using _traits = make_traits<::sqlpp::detail::text, ::sqlpp::tag::expression, ::sqlpp::tag::wrapped_value>;
using _traits = make_traits<::sqlpp::detail::text, ::sqlpp::tag::is_expression, ::sqlpp::tag::is_wrapped_value>;
using _recursive_traits = make_recursive_traits<>;
using _value_t = std::string;