diff --git a/include/sqlpp11/alias.h b/include/sqlpp11/alias.h index eeb9e2b6..99909bb5 100644 --- a/include/sqlpp11/alias.h +++ b/include/sqlpp11/alias.h @@ -35,7 +35,7 @@ namespace sqlpp template struct expression_alias_t { - using _traits = make_traits, tag::named_expression, tag::alias>; + using _traits = make_traits, tag::is_named_expression, tag::is_alias>; using _recursive_traits = make_recursive_traits; static_assert(is_expression_t::value, "invalid argument for an expression alias"); diff --git a/include/sqlpp11/any.h b/include/sqlpp11/any.h index a193b825..708911d9 100644 --- a/include/sqlpp11/any.h +++ b/include/sqlpp11/any.h @@ -35,7 +35,7 @@ namespace sqlpp template struct any_t { - using _traits = make_traits, ::sqlpp::tag::multi_expression>; + using _traits = make_traits, ::sqlpp::tag::is_multi_expression>; using _recursive_traits = make_recursive_traits; static_assert(is_select_t; struct _name_t diff --git a/include/sqlpp11/sort_order.h b/include/sqlpp11/sort_order.h index f7d0f72e..0a5053f2 100644 --- a/include/sqlpp11/sort_order.h +++ b/include/sqlpp11/sort_order.h @@ -41,7 +41,7 @@ namespace sqlpp template struct sort_order_t { - using _traits = make_traits; + using _traits = make_traits; using _recursive_traits = make_recursive_traits; Expression _expression; diff --git a/include/sqlpp11/statement.h b/include/sqlpp11/statement.h index 4d72757b..cce00ab5 100644 --- a/include/sqlpp11/statement.h +++ b/include/sqlpp11/statement.h @@ -134,16 +134,15 @@ namespace sqlpp using _policies_t = typename detail::statement_policies_t; using _traits = make_traits, - ::sqlpp::tag::select, - tag::expression_if, - tag::named_expression_if>; + ::sqlpp::tag::is_select, + tag::is_expression_if, + tag::is_named_expression_if, + 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 struct statement_name_t { - using _traits = make_traits; + using _traits = make_traits; using _recursive_traits = make_recursive_traits<>; // Data diff --git a/include/sqlpp11/sum.h b/include/sqlpp11/sum.h index 89045be9..8e3553f3 100644 --- a/include/sqlpp11/sum.h +++ b/include/sqlpp11/sum.h @@ -35,7 +35,7 @@ namespace sqlpp struct sum_t: public value_type_of::template expression_operators>, public alias_operators> { - using _traits = make_traits, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>; + using _traits = make_traits, ::sqlpp::tag::is_expression, ::sqlpp::tag::is_named_expression>; using _recursive_traits = make_recursive_traits; static_assert(is_noop::value or std::is_same::value, "sum() used with flag other than 'distinct'"); diff --git a/include/sqlpp11/table.h b/include/sqlpp11/table.h index 6bca7037..52f747f3 100644 --- a/include/sqlpp11/table.h +++ b/include/sqlpp11/table.h @@ -42,7 +42,7 @@ namespace sqlpp template struct table_t: public table_base_t, public ColumnSpec::_name_t::template _member_t>... { - using _traits = make_traits; + using _traits = make_traits; struct _recursive_traits { diff --git a/include/sqlpp11/table_alias.h b/include/sqlpp11/table_alias.h index 7f0d2b83..58f09415 100644 --- a/include/sqlpp11/table_alias.h +++ b/include/sqlpp11/table_alias.h @@ -39,7 +39,7 @@ namespace sqlpp struct table_alias_t: public ColumnSpec::_name_t::template _member_t>... { //FIXME: Need to add join functionality - using _traits = make_traits, tag::table, tag::alias, tag::named_expression_if>>; + using _traits = make_traits, tag::is_table, tag::is_alias, tag::is_named_expression_if>>; struct _recursive_traits { diff --git a/include/sqlpp11/text.h b/include/sqlpp11/text.h index 5ee7c6af..2d9b0087 100644 --- a/include/sqlpp11/text.h +++ b/include/sqlpp11/text.h @@ -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 diff --git a/include/sqlpp11/tvin.h b/include/sqlpp11/tvin.h index 44d26825..0b80cc44 100644 --- a/include/sqlpp11/tvin.h +++ b/include/sqlpp11/tvin.h @@ -39,7 +39,7 @@ namespace sqlpp template struct tvin_arg_t { - using _traits = make_traits, tag::expression>; + using _traits = make_traits, tag::is_expression>; using _recursive_traits = make_recursive_traits; using _operand_t = Operand; @@ -89,7 +89,7 @@ namespace sqlpp template struct tvin_t { - using _traits = make_traits, tag::expression>; + using _traits = make_traits, tag::is_expression>; using _recursive_traits = make_recursive_traits; using _operand_t = Operand; diff --git a/include/sqlpp11/type_traits.h b/include/sqlpp11/type_traits.h index af03a829..47f04a99 100644 --- a/include/sqlpp11/type_traits.h +++ b/include/sqlpp11/type_traits.h @@ -71,56 +71,30 @@ namespace sqlpp template\ using name##_t = typename detail::name##_impl::type; -#define SQLPP_IS_VALUE_TRAIT_GENERATOR(name) \ - namespace tag\ - {\ - struct name{};\ - };\ - namespace detail\ - {\ - template\ - struct is_##name##_impl { using type = std::false_type; };\ - template\ - struct is_##name##_impl::value>::type> { using type = std::true_type; };\ - }\ - template\ - using is_##name##_t = typename detail::is_##name##_impl::type; - -#define SQLPP_TYPE_TRAIT_GENERATOR(name) \ - namespace detail\ - {\ - template\ - struct name##_impl: std::false_type {};\ - template\ - struct name##_impl::value>::type>: std::true_type {};\ - }\ - template\ - struct name##_t: detail::name##_impl {}; - - 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 using is_numeric_t = detail::any_t< - detail::is_element_of::value, - detail::is_element_of::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::value, + detail::is_element_of::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 - using named_expression_if = typename std::conditional::type; + using is_named_expression_if = typename std::conditional::type; } namespace tag { template - using expression_if = typename std::conditional::type; + using is_expression_if = typename std::conditional::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); diff --git a/include/sqlpp11/update.h b/include/sqlpp11/update.h index 215200d6..e017865a 100644 --- a/include/sqlpp11/update.h +++ b/include/sqlpp11/update.h @@ -43,7 +43,7 @@ namespace sqlpp struct update_t: public statement_name_t { - using _traits = make_traits; + using _traits = make_traits; struct _name_t {}; template diff --git a/include/sqlpp11/update_list.h b/include/sqlpp11/update_list.h index 39432983..6b8a255a 100644 --- a/include/sqlpp11/update_list.h +++ b/include/sqlpp11/update_list.h @@ -56,7 +56,7 @@ namespace sqlpp template struct update_list_t { - using _traits = make_traits; + using _traits = make_traits; using _recursive_traits = make_recursive_traits; using _is_dynamic = is_database; @@ -130,7 +130,7 @@ namespace sqlpp struct no_update_list_t { - using _traits = make_traits; + using _traits = make_traits; using _recursive_traits = make_recursive_traits<>; // Data diff --git a/include/sqlpp11/using.h b/include/sqlpp11/using.h index 0214851b..a4897474 100644 --- a/include/sqlpp11/using.h +++ b/include/sqlpp11/using.h @@ -57,7 +57,7 @@ namespace sqlpp template struct using_t { - using _traits = make_traits; + using _traits = make_traits; using _recursive_traits = make_recursive_traits; using _is_dynamic = is_database; @@ -128,7 +128,7 @@ namespace sqlpp // NO USING YET struct no_using_t { - using _traits = make_traits; + using _traits = make_traits; using _recursive_traits = make_recursive_traits<>; // Data diff --git a/include/sqlpp11/where.h b/include/sqlpp11/where.h index 0a8d704d..20933fee 100644 --- a/include/sqlpp11/where.h +++ b/include/sqlpp11/where.h @@ -58,7 +58,7 @@ namespace sqlpp template struct where_t { - using _traits = make_traits; + using _traits = make_traits; using _recursive_traits = make_recursive_traits; using _is_dynamic = is_database; @@ -141,7 +141,7 @@ namespace sqlpp template<> struct where_t { - using _traits = make_traits; + using _traits = make_traits; using _recursive_traits = make_recursive_traits<>; // Data @@ -184,7 +184,7 @@ namespace sqlpp template struct no_where_t { - using _traits = make_traits; + using _traits = make_traits; using _recursive_traits = make_recursive_traits<>; // Data diff --git a/include/sqlpp11/wrap_operand.h b/include/sqlpp11/wrap_operand.h index 177f9294..0b0f8d23 100644 --- a/include/sqlpp11/wrap_operand.h +++ b/include/sqlpp11/wrap_operand.h @@ -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;