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

Rename has_name to has_name_tag

This commit is contained in:
Roland Bock 2024-10-27 12:54:11 +01:00
parent 5c7facfdd4
commit eef8fab8c6
17 changed files with 48 additions and 49 deletions

View File

@ -81,7 +81,7 @@ namespace sqlpp
-> parameter_t<value_type_of_t<ValueType>, NameTagProvider> -> parameter_t<value_type_of_t<ValueType>, NameTagProvider>
{ {
static_assert(has_value_type<ValueType>::value, "first argument is not a value type"); static_assert(has_value_type<ValueType>::value, "first argument is not a value type");
static_assert(has_name<NameTagProvider>::value, "second argument does not have a name"); static_assert(has_name_tag<NameTagProvider>::value, "second argument does not have a name");
return {}; return {};
} }
} // namespace sqlpp } // namespace sqlpp

View File

@ -54,9 +54,8 @@ namespace sqlpp
template <typename T> template <typename T>
using name_tag_of_t = typename name_tag_of<T>::type; using name_tag_of_t = typename name_tag_of<T>::type;
#warning: rename to has_name_tag
// Override this for other classes like columns or tables. // Override this for other classes like columns or tables.
template<typename T> template<typename T>
struct has_name : public std::integral_constant<bool, not std::is_same<name_tag_of_t<T>, no_name_t>::value> {}; struct has_name_tag : public std::integral_constant<bool, not std::is_same<name_tag_of_t<T>, no_name_t>::value> {};
} // namespace sqlpp } // namespace sqlpp

View File

@ -84,7 +84,7 @@ namespace sqlpp
template <typename Expr, typename NameTagProvider> template <typename Expr, typename NameTagProvider>
using check_as_args = ::sqlpp::enable_if_t< using check_as_args = ::sqlpp::enable_if_t<
has_value_type<Expr>::value and not is_alias_t<Expr>::value and has_name<NameTagProvider>::value has_value_type<Expr>::value and not is_alias_t<Expr>::value and has_name_tag<NameTagProvider>::value
>; >;
template <typename Expr, typename NameTagProvider, typename = check_as_args<Expr, NameTagProvider>> template <typename Expr, typename NameTagProvider, typename = check_as_args<Expr, NameTagProvider>>

View File

@ -100,7 +100,7 @@ namespace sqlpp
{ {
return operator()(context, t._expr, index); return operator()(context, t._expr, index);
} }
static_assert(has_name<T>::value, "select columns have to have a name"); static_assert(has_name_tag<T>::value, "select columns have to have a name");
return operator()(context, as(sqlpp::nullopt, t._expr), index); return operator()(context, as(sqlpp::nullopt, t._expr), index);
} }

View File

@ -56,8 +56,8 @@ void test_avg(Value v)
static_assert(sqlpp::has_enabled_as<decltype(avg(sqlpp::distinct, v_not_null))>::value, ""); static_assert(sqlpp::has_enabled_as<decltype(avg(sqlpp::distinct, v_not_null))>::value, "");
// avg has a name // avg has a name
static_assert(sqlpp::has_name<decltype(avg(v_not_null))>::value, ""); static_assert(sqlpp::has_name_tag<decltype(avg(v_not_null))>::value, "");
static_assert(sqlpp::has_name<decltype(avg(sqlpp::distinct, v_not_null))>::value, ""); static_assert(sqlpp::has_name_tag<decltype(avg(sqlpp::distinct, v_not_null))>::value, "");
static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(avg(v_not_null))>, sqlpp::alias::_avg_t::_sqlpp_name_tag>::value, ""); static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(avg(v_not_null))>, sqlpp::alias::_avg_t::_sqlpp_name_tag>::value, "");
static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(avg(sqlpp::distinct, v_not_null))>, sqlpp::alias::_avg_t::_sqlpp_name_tag>::value, ""); static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(avg(sqlpp::distinct, v_not_null))>, sqlpp::alias::_avg_t::_sqlpp_name_tag>::value, "");

View File

@ -54,8 +54,8 @@ void test_count(Value v)
static_assert(sqlpp::has_enabled_as<decltype(sqlpp::distinct, count(v_not_null))>::value, ""); static_assert(sqlpp::has_enabled_as<decltype(sqlpp::distinct, count(v_not_null))>::value, "");
// count has a name // count has a name
static_assert(sqlpp::has_name<decltype(count(v_not_null))>::value, ""); static_assert(sqlpp::has_name_tag<decltype(count(v_not_null))>::value, "");
static_assert(sqlpp::has_name<decltype(count(sqlpp::distinct, v_not_null))>::value, ""); static_assert(sqlpp::has_name_tag<decltype(count(sqlpp::distinct, v_not_null))>::value, "");
static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(count(v_not_null))>, sqlpp::alias::_count_t::_sqlpp_name_tag>::value, ""); static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(count(v_not_null))>, sqlpp::alias::_count_t::_sqlpp_name_tag>::value, "");
static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(count(sqlpp::distinct, v_not_null))>, sqlpp::alias::_count_t::_sqlpp_name_tag>::value, ""); static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(count(sqlpp::distinct, v_not_null))>, sqlpp::alias::_count_t::_sqlpp_name_tag>::value, "");

View File

@ -56,8 +56,8 @@ void test_max(Value v)
static_assert(sqlpp::has_enabled_as<decltype(sqlpp::distinct, max(v_not_null))>::value, ""); static_assert(sqlpp::has_enabled_as<decltype(sqlpp::distinct, max(v_not_null))>::value, "");
// max has a name // max has a name
static_assert(sqlpp::has_name<decltype(max(v_not_null))>::value, ""); static_assert(sqlpp::has_name_tag<decltype(max(v_not_null))>::value, "");
static_assert(sqlpp::has_name<decltype(max(sqlpp::distinct, v_not_null))>::value, ""); static_assert(sqlpp::has_name_tag<decltype(max(sqlpp::distinct, v_not_null))>::value, "");
static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(max(v_not_null))>, sqlpp::alias::_max_t::_sqlpp_name_tag>::value, ""); static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(max(v_not_null))>, sqlpp::alias::_max_t::_sqlpp_name_tag>::value, "");
static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(max(sqlpp::distinct, v_not_null))>, sqlpp::alias::_max_t::_sqlpp_name_tag>::value, ""); static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(max(sqlpp::distinct, v_not_null))>, sqlpp::alias::_max_t::_sqlpp_name_tag>::value, "");

View File

@ -56,8 +56,8 @@ void test_min(Value v)
static_assert(sqlpp::has_enabled_as<decltype(sqlpp::distinct, min(v_not_null))>::value, ""); static_assert(sqlpp::has_enabled_as<decltype(sqlpp::distinct, min(v_not_null))>::value, "");
// min has a name // min has a name
static_assert(sqlpp::has_name<decltype(min(v_not_null))>::value, ""); static_assert(sqlpp::has_name_tag<decltype(min(v_not_null))>::value, "");
static_assert(sqlpp::has_name<decltype(min(sqlpp::distinct, v_not_null))>::value, ""); static_assert(sqlpp::has_name_tag<decltype(min(sqlpp::distinct, v_not_null))>::value, "");
static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(min(v_not_null))>, sqlpp::alias::_min_t::_sqlpp_name_tag>::value, ""); static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(min(v_not_null))>, sqlpp::alias::_min_t::_sqlpp_name_tag>::value, "");
static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(min(sqlpp::distinct, v_not_null))>, sqlpp::alias::_min_t::_sqlpp_name_tag>::value, ""); static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(min(sqlpp::distinct, v_not_null))>, sqlpp::alias::_min_t::_sqlpp_name_tag>::value, "");

View File

@ -59,9 +59,9 @@ void test_aggregate_functions(Value v)
static_assert(sqlpp::has_enabled_as<decltype(min(v_not_null).over())>::value, ""); static_assert(sqlpp::has_enabled_as<decltype(min(v_not_null).over())>::value, "");
// Aggregate functions have a name // Aggregate functions have a name
static_assert(sqlpp::has_name<decltype(count(v_not_null).over())>::value, ""); static_assert(sqlpp::has_name_tag<decltype(count(v_not_null).over())>::value, "");
static_assert(sqlpp::has_name<decltype(max(v_not_null).over())>::value, ""); static_assert(sqlpp::has_name_tag<decltype(max(v_not_null).over())>::value, "");
static_assert(sqlpp::has_name<decltype(min(v_not_null).over())>::value, ""); static_assert(sqlpp::has_name_tag<decltype(min(v_not_null).over())>::value, "");
static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(count(v_not_null).over())>, sqlpp::alias::_count_t::_sqlpp_name_tag>::value, ""); static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(count(v_not_null).over())>, sqlpp::alias::_count_t::_sqlpp_name_tag>::value, "");
static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(min(v_not_null).over())>, sqlpp::alias::_min_t::_sqlpp_name_tag>::value, ""); static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(min(v_not_null).over())>, sqlpp::alias::_min_t::_sqlpp_name_tag>::value, "");
@ -107,8 +107,8 @@ void test_numeric_aggregate_functions(Value v)
static_assert(sqlpp::has_enabled_as<decltype(avg(v_not_null).over())>::value, ""); static_assert(sqlpp::has_enabled_as<decltype(avg(v_not_null).over())>::value, "");
// Aggregate functions have a name // Aggregate functions have a name
static_assert(sqlpp::has_name<decltype(sum(v_not_null).over())>::value, ""); static_assert(sqlpp::has_name_tag<decltype(sum(v_not_null).over())>::value, "");
static_assert(sqlpp::has_name<decltype(avg(v_not_null).over())>::value, ""); static_assert(sqlpp::has_name_tag<decltype(avg(v_not_null).over())>::value, "");
static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(sum(v_not_null).over())>, sqlpp::alias::_sum_t::_sqlpp_name_tag>::value, ""); static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(sum(v_not_null).over())>, sqlpp::alias::_sum_t::_sqlpp_name_tag>::value, "");
static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(avg(v_not_null).over())>, sqlpp::alias::_avg_t::_sqlpp_name_tag>::value, ""); static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(avg(v_not_null).over())>, sqlpp::alias::_avg_t::_sqlpp_name_tag>::value, "");

View File

@ -57,8 +57,8 @@ void test_sum(Value v)
static_assert(sqlpp::has_enabled_as<decltype(sum(sqlpp::distinct, v_not_null))>::value, ""); static_assert(sqlpp::has_enabled_as<decltype(sum(sqlpp::distinct, v_not_null))>::value, "");
// sum has a name // sum has a name
static_assert(sqlpp::has_name<decltype(sum(v_not_null))>::value, ""); static_assert(sqlpp::has_name_tag<decltype(sum(v_not_null))>::value, "");
static_assert(sqlpp::has_name<decltype(sum(sqlpp::distinct, v_not_null))>::value, ""); static_assert(sqlpp::has_name_tag<decltype(sum(sqlpp::distinct, v_not_null))>::value, "");
static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(sum(v_not_null))>, sqlpp::alias::_sum_t::_sqlpp_name_tag>::value, ""); static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(sum(v_not_null))>, sqlpp::alias::_sum_t::_sqlpp_name_tag>::value, "");
static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(sum(sqlpp::distinct, v_not_null))>, sqlpp::alias::_sum_t::_sqlpp_name_tag>::value, ""); static_assert(std::is_same<sqlpp::name_tag_of_t<decltype(sum(sqlpp::distinct, v_not_null))>, sqlpp::alias::_sum_t::_sqlpp_name_tag>::value, "");

View File

@ -126,7 +126,7 @@ void test_select_columns()
// The columns in group_by determine if aggregates are correct or not. // The columns in group_by determine if aggregates are correct or not.
{ {
using T = clause_of_t<decltype(select_columns(col_int, col_txt, col_bool))>; using T = clause_of_t<decltype(select_columns(col_int, col_txt, col_bool))>;
static_assert(not sqlpp::has_name<T>::value, ""); static_assert(not sqlpp::has_name_tag<T>::value, "");
static_assert(not sqlpp::has_value_type<T>::value, ""); static_assert(not sqlpp::has_value_type<T>::value, "");
static_assert(sqlpp::is_result_clause<T>::value, ""); static_assert(sqlpp::is_result_clause<T>::value, "");
static_assert(sqlpp::has_correct_aggregates<unknown, T>::value, ""); static_assert(sqlpp::has_correct_aggregates<unknown, T>::value, "");
@ -138,7 +138,7 @@ void test_select_columns()
// The columns in group_by determine if aggregates are correct or not. // The columns in group_by determine if aggregates are correct or not.
{ {
using T = clause_of_t<decltype(select_columns(col_int, max(col_txt), declare_group_by_column(v).as(cheese)))>; using T = clause_of_t<decltype(select_columns(col_int, max(col_txt), declare_group_by_column(v).as(cheese)))>;
static_assert(not sqlpp::has_name<T>::value, ""); static_assert(not sqlpp::has_name_tag<T>::value, "");
static_assert(not sqlpp::has_value_type<T>::value, ""); static_assert(not sqlpp::has_value_type<T>::value, "");
static_assert(sqlpp::is_result_clause<T>::value, ""); static_assert(sqlpp::is_result_clause<T>::value, "");
static_assert(not sqlpp::has_correct_aggregates<unknown, T>::value, ""); static_assert(not sqlpp::has_correct_aggregates<unknown, T>::value, "");

View File

@ -54,10 +54,10 @@ void test_dynamic(Value v)
static_assert(not sqlpp::has_value_type<decltype(v_not_null_alias)>::value, ""); static_assert(not sqlpp::has_value_type<decltype(v_not_null_alias)>::value, "");
static_assert(not sqlpp::has_value_type<decltype(v_maybe_null_alias)>::value, ""); static_assert(not sqlpp::has_value_type<decltype(v_maybe_null_alias)>::value, "");
static_assert(not sqlpp::has_name<decltype(v_not_null)>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(v_not_null)>::value, "");
static_assert(not sqlpp::has_name<decltype(v_maybe_null)>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(v_maybe_null)>::value, "");
static_assert(not sqlpp::has_name<decltype(v_not_null_alias)>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(v_not_null_alias)>::value, "");
static_assert(not sqlpp::has_name<decltype(v_maybe_null_alias)>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(v_maybe_null_alias)>::value, "");
static_assert(is_select_column_value_type<decltype(v_not_null), OptValueType>::value, ""); static_assert(is_select_column_value_type<decltype(v_not_null), OptValueType>::value, "");
static_assert(is_select_column_value_type<decltype(v_maybe_null), OptValueType>::value, ""); static_assert(is_select_column_value_type<decltype(v_maybe_null), OptValueType>::value, "");

View File

@ -53,9 +53,9 @@ void test_assign_expression(const Column& col, const Value& v)
static_assert(not sqlpp::has_value_type<decltype(col = v_maybe_null)>::value, ""); static_assert(not sqlpp::has_value_type<decltype(col = v_maybe_null)>::value, "");
// Assignments have no name // Assignments have no name
static_assert(not sqlpp::has_name<decltype(col = sqlpp::default_value)>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(col = sqlpp::default_value)>::value, "");
static_assert(not sqlpp::has_name<decltype(col = v_not_null)>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(col = v_not_null)>::value, "");
static_assert(not sqlpp::has_name<decltype(col = v_maybe_null)>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(col = v_maybe_null)>::value, "");
// Assignment nodes // Assignment nodes
static_assert(std::is_same<sqlpp::nodes_of_t<decltype(col = sqlpp::default_value)>, static_assert(std::is_same<sqlpp::nodes_of_t<decltype(col = sqlpp::default_value)>,

View File

@ -46,10 +46,10 @@ void test_as_expression(Value v)
static_assert(not sqlpp::has_value_type<decltype(v_dynamic_not_null.as(cheese))>::value, ""); static_assert(not sqlpp::has_value_type<decltype(v_dynamic_not_null.as(cheese))>::value, "");
static_assert(not sqlpp::has_value_type<decltype(v_dynamic_maybe_null.as(cheese))>::value, ""); static_assert(not sqlpp::has_value_type<decltype(v_dynamic_maybe_null.as(cheese))>::value, "");
static_assert(not sqlpp::has_name<decltype(v_not_null.as(cheese))>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(v_not_null.as(cheese))>::value, "");
static_assert(not sqlpp::has_name<decltype(v_maybe_null.as(cheese))>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(v_maybe_null.as(cheese))>::value, "");
static_assert(not sqlpp::has_name<decltype(v_dynamic_not_null.as(cheese))>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(v_dynamic_not_null.as(cheese))>::value, "");
static_assert(not sqlpp::has_name<decltype(v_dynamic_maybe_null.as(cheese))>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(v_dynamic_maybe_null.as(cheese))>::value, "");
static_assert(is_select_column_value_type<decltype(v_not_null.as(cheese)), ValueType>::value, ""); static_assert(is_select_column_value_type<decltype(v_not_null.as(cheese)), ValueType>::value, "");
static_assert(is_select_column_value_type<decltype(v_maybe_null.as(cheese)), OptValueType>::value, ""); static_assert(is_select_column_value_type<decltype(v_maybe_null.as(cheese)), OptValueType>::value, "");

View File

@ -52,10 +52,10 @@ void test_as_expression(Value v)
static_assert(not sqlpp::has_value_type<decltype(dynamic(true, v_maybe_null.order(sqlpp::sort_type::asc)))>::value, ""); static_assert(not sqlpp::has_value_type<decltype(dynamic(true, v_maybe_null.order(sqlpp::sort_type::asc)))>::value, "");
// Sort order expressions have no name. // Sort order expressions have no name.
static_assert(not sqlpp::has_name<decltype(v_not_null.asc())>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(v_not_null.asc())>::value, "");
static_assert(not sqlpp::has_name<decltype(v_maybe_null.asc())>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(v_maybe_null.asc())>::value, "");
static_assert(not sqlpp::has_name<decltype(dynamic(true, v_not_null.asc()))>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(dynamic(true, v_not_null.asc()))>::value, "");
static_assert(not sqlpp::has_name<decltype(dynamic(true, v_maybe_null.asc()))>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(dynamic(true, v_maybe_null.asc()))>::value, "");
// Sort order expression do not enable the `as` member function. // Sort order expression do not enable the `as` member function.
static_assert(not sqlpp::has_enabled_as<decltype(v_not_null.asc())>::value, ""); static_assert(not sqlpp::has_enabled_as<decltype(v_not_null.asc())>::value, "");

View File

@ -124,7 +124,7 @@ int main()
static_assert(std::is_same<sqlpp::value_type_of_t<decltype(assign(bar.intN, sqlpp::default_value))>, sqlpp::no_value_t>::value, ""); static_assert(std::is_same<sqlpp::value_type_of_t<decltype(assign(bar.intN, sqlpp::default_value))>, sqlpp::no_value_t>::value, "");
// as expressions retain the value type of the real thing // as expressions retain the value type of the real thing
static_assert(sqlpp::has_name<decltype(bar.intN)>::value, ""); static_assert(sqlpp::has_name_tag<decltype(bar.intN)>::value, "");
sqlpp::as(bar.intN, bar.textN); sqlpp::as(bar.intN, bar.textN);
#if 0 #if 0

View File

@ -58,8 +58,8 @@ void test_select_as(Value v)
static_assert(is_same_type<decltype(select(v_maybe_null)), OptValueType>(), ""); static_assert(is_same_type<decltype(select(v_maybe_null)), OptValueType>(), "");
// A select of a single value can be named and used as a named value. // A select of a single value can be named and used as a named value.
static_assert(sqlpp::has_name<decltype(select(v_not_null).as(column))>::value, ""); static_assert(sqlpp::has_name_tag<decltype(select(v_not_null).as(column))>::value, "");
static_assert(sqlpp::has_name<decltype(select(v_maybe_null).as(column))>::value, ""); static_assert(sqlpp::has_name_tag<decltype(select(v_maybe_null).as(column))>::value, "");
static_assert(is_same_type<decltype(select(v_not_null).as(column)), ValueType>(), ""); static_assert(is_same_type<decltype(select(v_not_null).as(column)), ValueType>(), "");
static_assert(is_same_type<decltype(select(v_maybe_null).as(column)), OptValueType>(), ""); static_assert(is_same_type<decltype(select(v_maybe_null).as(column)), OptValueType>(), "");
@ -69,15 +69,15 @@ void test_select_as(Value v)
static_assert(sqlpp::is_table<decltype(select(v_maybe_null).as(column))>::value, ""); static_assert(sqlpp::is_table<decltype(select(v_maybe_null).as(column))>::value, "");
// The column of a single-value pseudo table can be used as named value // The column of a single-value pseudo table can be used as named value
static_assert(sqlpp::has_name<decltype(select(v_not_null).as(column).always)>::value, ""); static_assert(sqlpp::has_name_tag<decltype(select(v_not_null).as(column).always)>::value, "");
static_assert(sqlpp::has_name<decltype(select(v_maybe_null).as(column).sometimes)>::value, ""); static_assert(sqlpp::has_name_tag<decltype(select(v_maybe_null).as(column).sometimes)>::value, "");
static_assert(is_same_type<decltype(select(v_not_null).as(column).always), ValueType>(), ""); static_assert(is_same_type<decltype(select(v_not_null).as(column).always), ValueType>(), "");
static_assert(is_same_type<decltype(select(v_maybe_null).as(column).sometimes), OptValueType>(), ""); static_assert(is_same_type<decltype(select(v_maybe_null).as(column).sometimes), OptValueType>(), "");
// The column of a single-value pseudo table can be renamed and used as named value // The column of a single-value pseudo table can be renamed and used as named value
static_assert(not sqlpp::has_name<decltype(select(v_not_null).as(column).always.as(foo))>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(select(v_not_null).as(column).always.as(foo))>::value, "");
static_assert(not sqlpp::has_name<decltype(select(v_maybe_null).as(column).sometimes.as(foo))>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(select(v_maybe_null).as(column).sometimes.as(foo))>::value, "");
static_assert(sqlpp::select_column_has_name<decltype(select(v_not_null).as(column).always.as(foo))>::value, ""); static_assert(sqlpp::select_column_has_name<decltype(select(v_not_null).as(column).always.as(foo))>::value, "");
static_assert(sqlpp::select_column_has_name<decltype(select(v_maybe_null).as(column).sometimes.as(foo))>::value, ""); static_assert(sqlpp::select_column_has_name<decltype(select(v_maybe_null).as(column).sometimes.as(foo))>::value, "");
@ -91,22 +91,22 @@ void test_select_as(Value v)
static_assert(not sqlpp::has_value_type<decltype(select(v_not_null, v_maybe_null))>::value, ""); static_assert(not sqlpp::has_value_type<decltype(select(v_not_null, v_maybe_null))>::value, "");
// A select of multiple values can be named and used as a named value. // A select of multiple values can be named and used as a named value.
static_assert(sqlpp::has_name<decltype(select(v_not_null, v_maybe_null).as(column))>::value, ""); static_assert(sqlpp::has_name_tag<decltype(select(v_not_null, v_maybe_null).as(column))>::value, "");
static_assert(not sqlpp::has_value_type<decltype(select(v_not_null, v_maybe_null).as(column))>::value, ""); static_assert(not sqlpp::has_value_type<decltype(select(v_not_null, v_maybe_null).as(column))>::value, "");
// A select of multiple values can be named and used as a pseudo table // A select of multiple values can be named and used as a pseudo table
static_assert(sqlpp::is_table<decltype(select(v_not_null, v_maybe_null).as(table))>::value, ""); static_assert(sqlpp::is_table<decltype(select(v_not_null, v_maybe_null).as(table))>::value, "");
// The column of a multi-value pseudo table can be used as named value // The column of a multi-value pseudo table can be used as named value
static_assert(sqlpp::has_name<decltype(select(v_not_null, v_maybe_null).as(table).always)>::value, ""); static_assert(sqlpp::has_name_tag<decltype(select(v_not_null, v_maybe_null).as(table).always)>::value, "");
static_assert(sqlpp::has_name<decltype(select(v_not_null, v_maybe_null).as(table).sometimes)>::value, ""); static_assert(sqlpp::has_name_tag<decltype(select(v_not_null, v_maybe_null).as(table).sometimes)>::value, "");
static_assert(is_same_type<decltype(select(v_not_null, v_maybe_null).as(table).always), ValueType>(), ""); static_assert(is_same_type<decltype(select(v_not_null, v_maybe_null).as(table).always), ValueType>(), "");
static_assert(is_same_type<decltype(select(v_not_null, v_maybe_null).as(table).sometimes), OptValueType>(), ""); static_assert(is_same_type<decltype(select(v_not_null, v_maybe_null).as(table).sometimes), OptValueType>(), "");
// The column of a multi-value pseudo table can be renamed and used as named value // The column of a multi-value pseudo table can be renamed and used as named value
static_assert(not sqlpp::has_name<decltype(select(v_not_null, v_maybe_null).as(table).always.as(foo))>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(select(v_not_null, v_maybe_null).as(table).always.as(foo))>::value, "");
static_assert(not sqlpp::has_name<decltype(select(v_not_null, v_maybe_null).as(table).sometimes.as(foo))>::value, ""); static_assert(not sqlpp::has_name_tag<decltype(select(v_not_null, v_maybe_null).as(table).sometimes.as(foo))>::value, "");
static_assert(sqlpp::select_column_has_name<decltype(select(v_not_null, v_maybe_null).as(table).always.as(foo))>::value, ""); static_assert(sqlpp::select_column_has_name<decltype(select(v_not_null, v_maybe_null).as(table).always.as(foo))>::value, "");
static_assert(sqlpp::select_column_has_name<decltype(select(v_not_null, v_maybe_null).as(table).sometimes.as(foo))>::value, ""); static_assert(sqlpp::select_column_has_name<decltype(select(v_not_null, v_maybe_null).as(table).sometimes.as(foo))>::value, "");