0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-15 20:31:16 +08:00

Renamed named_expression to selectable

This commit is contained in:
rbock 2014-09-26 09:03:26 +02:00
parent 49eb21e709
commit 7c80a2a6e0
20 changed files with 97 additions and 102 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::is_named_expression, tag::is_alias>;
using _traits = make_traits<value_type_of<Expression>, tag::is_selectable, 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

@ -36,7 +36,7 @@ namespace sqlpp
public expression_operators<avg_t<Flag, Expr>, floating_point>,
public alias_operators<avg_t<Flag, Expr>>
{
using _traits = make_traits<floating_point, tag::is_expression, tag::is_named_expression>;
using _traits = make_traits<floating_point, tag::is_expression, tag::is_selectable>;
using _recursive_traits = make_recursive_traits<Expr, aggregate_function>;
static_assert(is_noop<Flag>::value or std::is_same<distinct_t, Flag>::value, "avg() used with flag other than 'distinct'");

View File

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

View File

@ -40,7 +40,7 @@ namespace sqlpp
public expression_operators<concat_t<First, Args...>, value_type_of<First>>,
public alias_operators<concat_t<First, Args...>>
{
using _traits = make_traits<value_type_of<First>, tag::is_expression, tag::is_named_expression>;
using _traits = make_traits<value_type_of<First>, tag::is_expression, tag::is_selectable>;
using _recursive_traits = make_recursive_traits<First, Args...>;
static_assert(sizeof...(Args) > 0, "concat requires two arguments at least");

View File

@ -37,7 +37,7 @@ namespace sqlpp
public expression_operators<count_t<Flag, Expr>, integral>,
public alias_operators<count_t<Flag, Expr>>
{
using _traits = make_traits<integral, tag::is_expression, tag::is_named_expression>;
using _traits = make_traits<integral, tag::is_expression, tag::is_selectable>;
struct _recursive_traits
{
using _required_tables = required_tables_of<Expr>;

View File

@ -36,7 +36,7 @@ namespace sqlpp
public expression_operators<exists_t<Select>, boolean>,
public alias_operators<exists_t<Select>>
{
using _traits = make_traits<boolean, tag::is_expression, tag::is_named_expression>;
using _traits = make_traits<boolean, tag::is_expression, tag::is_selectable>;
using _recursive_traits = make_recursive_traits<Select>;
static_assert(is_select_t<Select>::value, "exists() requires a select expression as argument");

View File

@ -39,7 +39,7 @@ namespace sqlpp
public expression_operators<in_t<NotInverted, Operand, Args...>, boolean>,
public alias_operators<in_t<NotInverted, Operand, Args...>>
{
using _traits = make_traits<boolean, tag::is_expression, tag::is_named_expression>;
using _traits = make_traits<boolean, tag::is_expression, tag::is_selectable>;
using _recursive_traits = make_recursive_traits<Operand, Args...>;
static constexpr bool _inverted = not NotInverted;

View File

@ -38,16 +38,11 @@ namespace sqlpp
public expression_operators<is_null_t<NotInverted, Operand>, boolean>,
public alias_operators<is_null_t<NotInverted, Operand>>
{
using _traits = make_traits<boolean, tag::is_expression, tag::is_named_expression>;
using _traits = make_traits<boolean, tag::is_expression, tag::is_selectable>;
using _recursive_traits = make_recursive_traits<Operand>;
static constexpr bool _inverted = not NotInverted;
struct _value_type: public boolean
{
using _is_named_expression = std::true_type;
};
struct _name_t
{
static constexpr const char* _get_name() { return _inverted ? "IS NOT NULL" : "IS NULL"; }

View File

@ -38,7 +38,7 @@ namespace sqlpp
public expression_operators<like_t<Operand, Pattern>, boolean>,
public alias_operators<like_t<Operand, Pattern>>
{
using _traits = make_traits<boolean, tag::is_expression, tag::is_named_expression>;
using _traits = make_traits<boolean, tag::is_expression, tag::is_selectable>;
using _recursive_traits = make_recursive_traits<Operand, Pattern>;
struct _name_t

View File

@ -36,7 +36,7 @@ namespace sqlpp
public expression_operators<max_t<Expr>, value_type_of<Expr>>,
public alias_operators<max_t<Expr>>
{
using _traits = make_traits<value_type_of<Expr>, tag::is_expression, tag::is_named_expression>;
using _traits = make_traits<value_type_of<Expr>, tag::is_expression, tag::is_selectable>;
using _recursive_traits = make_recursive_traits<Expr, aggregate_function>;
struct _name_t

View File

@ -36,7 +36,7 @@ namespace sqlpp
public expression_operators<min_t<Expr>, value_type_of<Expr>>,
public alias_operators<min_t<Expr>>
{
using _traits = make_traits<value_type_of<Expr>, tag::is_expression, tag::is_named_expression>;
using _traits = make_traits<value_type_of<Expr>, tag::is_expression, tag::is_selectable>;
using _recursive_traits = make_recursive_traits<Expr, aggregate_function>;
struct _name_t

View File

@ -44,7 +44,7 @@ namespace sqlpp
using _traits = make_traits<no_value_t>;
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");
static_assert(detail::all_t<is_selectable_t<Columns>::value...>::value, "multi_column parameters need to be named expressions");
multi_column_t(std::tuple<Columns...> columns):
_columns(columns)
@ -76,10 +76,10 @@ namespace sqlpp
template<typename AliasProvider, typename... Columns>
struct multi_column_alias_t
{
using _traits = make_traits<no_value_t, tag::is_alias, tag::is_multi_column, tag::is_named_expression>;
using _traits = make_traits<no_value_t, tag::is_alias, tag::is_multi_column, tag::is_selectable>;
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");
static_assert(detail::all_t<is_selectable_t<Columns>::value...>::value, "multi_column parameters need to be named expressions");
using _name_t = typename AliasProvider::_name_t;
@ -103,7 +103,7 @@ namespace sqlpp
struct _value_type: public no_value_t
{
using _is_named_expression = std::true_type;
using _is_selectable = std::true_type;
};
using _is_multi_column = std::true_type;

View File

@ -76,7 +76,7 @@ namespace sqlpp
auto parameter(const NamedExpr&)
-> parameter_t<value_type_of<NamedExpr>, NamedExpr>
{
static_assert(is_named_expression_t<NamedExpr>::value, "not a named expression");
static_assert(is_selectable_t<NamedExpr>::value, "not a named expression");
return {};
}

View File

@ -54,7 +54,7 @@ namespace sqlpp
template<typename Column>
struct select_traits<Column>
{
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 _traits = make_traits<value_type_of<Column>, tag::is_select_column_list, tag::is_return_value, tag::is_expression, tag::is_selectable>;
using _name_t = typename Column::_name_t;
};
}
@ -161,7 +161,7 @@ namespace sqlpp
static_assert(_is_dynamic::value or sizeof...(Columns), "at least one select expression required");
static_assert(not detail::has_duplicates<Columns...>::value, "at least one duplicate argument detected");
static_assert(detail::all_t<(is_named_expression_t<Columns>::value or is_multi_column_t<Columns>::value)...>::value, "at least one argument is not a named expression");
static_assert(detail::all_t<(is_selectable_t<Columns>::value or is_multi_column_t<Columns>::value)...>::value, "at least one argument is not a named expression");
static_assert(not detail::has_duplicates<typename Columns::_name_t...>::value, "at least one duplicate name detected");
struct _column_type {};
@ -183,14 +183,14 @@ namespace sqlpp
void add(NamedExpression namedExpression)
{
static_assert(_is_dynamic::value, "selected_columns::add() can only be called for dynamic_column");
static_assert(is_named_expression_t<NamedExpression>::value, "invalid named expression argument in selected_columns::add()");
static_assert(is_selectable_t<NamedExpression>::value, "invalid named expression argument in selected_columns::add()");
static_assert(TableCheckRequired::value or Policies::template _no_unknown_tables<NamedExpression>::value, "named expression uses tables unknown to this statement in selected_columns::add()");
using column_names = detail::make_type_set_t<typename Columns::_name_t...>;
static_assert(not detail::is_element_of<typename NamedExpression::_name_t, column_names>::value, "a column of this name is present in the select already");
using ok = detail::all_t<
_is_dynamic::value,
is_named_expression_t<NamedExpression>::value
is_selectable_t<NamedExpression>::value
>;
_add_impl(namedExpression, ok()); // dispatch to prevent compile messages after the static_assert

View File

@ -135,7 +135,7 @@ namespace sqlpp
using _traits = make_traits<value_type_of<_policies_t>,
tag::is_select,
tag_if<tag::is_expression, is_expression_t<_policies_t>::value>,
tag_if<tag::is_named_expression, is_expression_t<_policies_t>::value>,
tag_if<tag::is_selectable, is_expression_t<_policies_t>::value>,
tag::requires_braces>;
using _recursive_traits = typename _policies_t::_recursive_traits;
using _used_outer_tables = typename _policies_t::_all_provided_outer_tables;

View File

@ -36,7 +36,7 @@ namespace sqlpp
public expression_operators<sum_t<Flag, Expr>, value_type_of<Expr>>,
public alias_operators<sum_t<Flag, Expr>>
{
using _traits = make_traits<value_type_of<Expr>, tag::is_expression, tag::is_named_expression>;
using _traits = make_traits<value_type_of<Expr>, tag::is_expression, tag::is_selectable>;
using _recursive_traits = make_recursive_traits<Expr, aggregate_function>;
static_assert(is_noop<Flag>::value or std::is_same<distinct_t, Flag>::value, "sum() used with flag other than 'distinct'");

View File

@ -40,7 +40,7 @@ namespace sqlpp
public member_t<ColumnSpec, column_t<AliasProvider, ColumnSpec>>...
{
//FIXME: Need to add join functionality
using _traits = make_traits<value_type_of<Table>, tag::is_table, tag::is_alias, tag_if<tag::is_named_expression, is_expression_t<Table>::value>>;
using _traits = make_traits<value_type_of<Table>, tag::is_table, tag::is_alias, tag_if<tag::is_selectable, is_expression_t<Table>::value>>;
struct _recursive_traits
{

View File

@ -111,7 +111,7 @@ namespace sqlpp
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_named_expression);
SQLPP_VALUE_TRAIT_GENERATOR(is_selectable);
SQLPP_VALUE_TRAIT_GENERATOR(is_multi_expression);
SQLPP_VALUE_TRAIT_GENERATOR(is_alias);
SQLPP_VALUE_TRAIT_GENERATOR(is_select_flag);

View File

@ -50,15 +50,15 @@ int main()
using TI = decltype(t.alpha.in(1, 2, 3));
using TF = decltype(f.omega.in(1.0, 2.0, 3.0));
using TT = decltype(t.beta.in("a", "b", "c"));
static_assert(sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TI>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TF>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TT>::value, "type requirement");
@ -69,15 +69,15 @@ int main()
using TI = decltype(t.alpha.in(sqlpp::value_list(std::vector<int>({1, 2, 3}))));
using TF = decltype(f.omega.in(sqlpp::value_list(std::vector<float>({1.0, 2.0, 3.0}))));
using TT = decltype(t.beta.in(sqlpp::value_list(std::vector<std::string>({"a", "b", "c"}))));
static_assert(sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TI>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TF>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TT>::value, "type requirement");
@ -88,15 +88,15 @@ int main()
using TI = decltype(t.alpha.not_in(1, 2, 3));
using TF = decltype(f.omega.not_in(1.0, 2.0, 3.0));
using TT = decltype(t.beta.not_in("a", "b", "c"));
static_assert(sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TI>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TF>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TT>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TT>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TT>::value, "type requirement");
@ -107,15 +107,15 @@ int main()
using TI = decltype(t.alpha.not_in(sqlpp::value_list(std::vector<int>({1, 2, 3}))));
using TF = decltype(f.omega.not_in(sqlpp::value_list(std::vector<float>({1.0, 2.0, 3.0}))));
using TT = decltype(t.beta.not_in(sqlpp::value_list(std::vector<std::string>({"a", "b", "c"}))));
static_assert(sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TI>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TF>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TT>::value, "type requirement");
@ -124,7 +124,7 @@ int main()
// Test like
{
using TT = decltype(t.beta.like("%c%"));
static_assert(sqlpp::is_named_expression_t<TT>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TT>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TT>::value, "type requirement");
@ -141,15 +141,15 @@ int main()
static_assert(std::is_same<TI, TTI>::value, "type requirement");
static_assert(std::is_same<TF, TTF>::value, "type requirement");
static_assert(std::is_same<TT, TTT>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TI>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TF>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TT>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TT>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TT>::value, "type requirement");
@ -166,15 +166,15 @@ int main()
static_assert(std::is_same<TI, TTI>::value, "type requirement");
static_assert(std::is_same<TF, TTF>::value, "type requirement");
static_assert(std::is_same<TT, TTT>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TI>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TF>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TT>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TT>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TT>::value, "type requirement");
@ -187,11 +187,11 @@ int main()
{
using TI = decltype(exists(select(t.alpha).from(t)));
using TT = decltype(exists(select(t.beta).from(t)));
static_assert(sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TI>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TT>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TT>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TT>::value, "type requirement");
@ -206,17 +206,17 @@ int main()
using TI = decltype(any(select(t.alpha).from(t)));
using TT = decltype(any(select(t.beta).from(t)));
using TF = decltype(any(select(f.omega).from(f)));
static_assert(not sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_multi_expression_t<TI>::value, "type requirement");
static_assert(sqlpp::is_numeric_t<TI>::value, "type requirement");
static_assert(sqlpp::is_integral_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_multi_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_numeric_t<TF>::value, "tFpe requirement");
static_assert(sqlpp::is_floating_point_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TT>::value, "type requirement");
static_assert(sqlpp::is_multi_expression_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_integral_t<TT>::value, "type requirement");
@ -229,18 +229,18 @@ int main()
using TI = decltype(some(select(t.alpha).from(t)));
using TT = decltype(some(select(t.beta).from(t)));
using TF = decltype(some(select(f.omega).from(f)));
static_assert(not sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_multi_expression_t<TI>::value, "type requirement");
static_assert(sqlpp::is_numeric_t<TI>::value, "type requirement");
static_assert(sqlpp::is_integral_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TI>::value, "type requirement");
static_assert(sqlpp::is_numeric_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_multi_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_floating_point_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_text_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TT>::value, "type requirement");
static_assert(sqlpp::is_multi_expression_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_integral_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_floating_point_t<TT>::value, "type requirement");
@ -254,11 +254,11 @@ int main()
{
using TI = decltype(avg(t.alpha));
using TF = decltype(avg(f.omega));
static_assert(sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_numeric_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_integral_t<TI>::value, "type requirement");
static_assert(sqlpp::is_floating_point_t<TI>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_numeric_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_integral_t<TF>::value, "type requirement");
static_assert(sqlpp::is_floating_point_t<TF>::value, "type requirement");
@ -269,15 +269,15 @@ int main()
using TI = decltype(count(t.alpha));
using TT = decltype(count(t.beta));
using TF = decltype(count(f.omega));
static_assert(sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_numeric_t<TI>::value, "type requirement");
static_assert(sqlpp::is_integral_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_floating_point_t<TI>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_numeric_t<TF>::value, "type requirement");
static_assert(sqlpp::is_integral_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_floating_point_t<TF>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TT>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TT>::value, "type requirement");
static_assert(sqlpp::is_numeric_t<TT>::value, "type requirement");
static_assert(sqlpp::is_integral_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_floating_point_t<TT>::value, "type requirement");
@ -288,15 +288,15 @@ int main()
using TI = decltype(max(t.alpha));
using TF = decltype(max(f.omega));
using TT = decltype(max(t.beta));
static_assert(sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_numeric_t<TI>::value, "type requirement");
static_assert(sqlpp::is_integral_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_floating_point_t<TI>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_numeric_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_integral_t<TF>::value, "type requirement");
static_assert(sqlpp::is_floating_point_t<TF>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TT>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TT>::value, "type requirement");
static_assert(sqlpp::is_text_t<TT>::value, "type requirement");
}
@ -306,15 +306,15 @@ int main()
using TI = decltype(min(t.alpha));
using TF = decltype(min(f.omega));
using TT = decltype(min(t.beta));
static_assert(sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_numeric_t<TI>::value, "type requirement");
static_assert(sqlpp::is_integral_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_floating_point_t<TI>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_numeric_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_integral_t<TF>::value, "type requirement");
static_assert(sqlpp::is_floating_point_t<TF>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TT>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_numeric_t<TT>::value, "type requirement");
static_assert(sqlpp::is_text_t<TT>::value, "type requirement");
}
@ -323,11 +323,11 @@ int main()
{
using TI = decltype(sum(t.alpha));
using TF = decltype(sum(f.omega));
static_assert(sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_numeric_t<TI>::value, "type requirement");
static_assert(sqlpp::is_integral_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_floating_point_t<TI>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<TF>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<TF>::value, "type requirement");
static_assert(sqlpp::is_numeric_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_integral_t<TF>::value, "type requirement");
static_assert(sqlpp::is_floating_point_t<TF>::value, "type requirement");
@ -342,13 +342,13 @@ int main()
using TI = decltype(sqlpp::value(7));
using TF = decltype(sqlpp::value(1.5));
using TT = decltype(sqlpp::value("cheesecake"));
static_assert(not sqlpp::is_named_expression_t<TB>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TB>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TB>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<TB>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TB>::value, "type requirement");
static_assert(sqlpp::is_integral_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_floating_point_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TT>::value, "type requirement");
static_assert(sqlpp::is_text_t<TT>::value, "type requirement");
}
@ -358,13 +358,13 @@ int main()
using TI = decltype(flatten(t.alpha, db));
using TF = decltype(flatten(f.omega, db));
using TT = decltype(flatten(t.beta, db));
static_assert(not sqlpp::is_named_expression_t<TB>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TB>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TB>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<TB>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TB>::value, "type requirement");
static_assert(sqlpp::is_integral_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_floating_point_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TT>::value, "type requirement");
static_assert(sqlpp::is_text_t<TT>::value, "type requirement");
}
@ -382,13 +382,13 @@ int main()
static_assert(std::is_same<TI, TIN>::value, "type_requirement");
static_assert(std::is_same<TF, TFN>::value, "type_requirement");
static_assert(std::is_same<TT, TTN>::value, "type_requirement");
static_assert(not sqlpp::is_named_expression_t<TB>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TB>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TB>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<TB>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TB>::value, "type requirement");
static_assert(sqlpp::is_integral_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_floating_point_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TT>::value, "type requirement");
static_assert(sqlpp::is_text_t<TT>::value, "type requirement");
}
@ -398,20 +398,20 @@ int main()
using TI = decltype(sqlpp::verbatim<sqlpp::bigint>("42"));
using TF = decltype(sqlpp::verbatim<sqlpp::floating_point>("1.5"));
using TT = decltype(sqlpp::verbatim<sqlpp::text>("cheesecake"));
static_assert(not sqlpp::is_named_expression_t<TB>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TB>::value, "type requirement");
static_assert(sqlpp::is_boolean_t<TB>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<TB>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TB>::value, "type requirement");
static_assert(sqlpp::is_integral_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<TI>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TI>::value, "type requirement");
static_assert(sqlpp::is_floating_point_t<TF>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<TT>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<TT>::value, "type requirement");
static_assert(sqlpp::is_text_t<TT>::value, "type requirement");
}
// test verbatim_table
{
using T = decltype(sqlpp::verbatim_table("cheesecake"));
static_assert(not sqlpp::is_named_expression_t<T>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<T>::value, "type requirement");
static_assert(not sqlpp::is_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_table_t<T>::value, "type requirement");
}
@ -419,7 +419,7 @@ int main()
// test verbatim_table alias
{
using T = decltype(sqlpp::verbatim_table("cheesecake").as(kaesekuchen));
static_assert(not sqlpp::is_named_expression_t<T>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<T>::value, "type requirement");
static_assert(not sqlpp::is_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_table_t<T>::value, "type requirement");
static_assert(sqlpp::is_alias_t<T>::value, "type requirement");

View File

@ -56,7 +56,7 @@ int main()
static_assert(not sqlpp::is_integral_t<T>::value, "type requirement");
static_assert(not sqlpp::is_floating_point_t<T>::value, "type requirement");
static_assert(not sqlpp::is_expression_t<T>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<T>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<T>::value, "type requirement");
static_assert(not sqlpp::require_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_update_t<T>::value, "type requirement");
@ -74,7 +74,7 @@ int main()
static_assert(not sqlpp::is_integral_t<T>::value, "type requirement");
static_assert(not sqlpp::is_floating_point_t<T>::value, "type requirement");
static_assert(not sqlpp::is_expression_t<T>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<T>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<T>::value, "type requirement");
static_assert(not sqlpp::require_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_update_t<T>::value, "type requirement");
@ -92,7 +92,7 @@ int main()
static_assert(sqlpp::is_integral_t<T>::value, "type requirement");
static_assert(not sqlpp::is_floating_point_t<T>::value, "type requirement");
static_assert(sqlpp::is_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<T>::value, "type requirement");
static_assert(not sqlpp::require_insert_t<T>::value, "type requirement");
static_assert(sqlpp::must_not_insert_t<T>::value, "type requirement");
static_assert(sqlpp::must_not_update_t<T>::value, "type requirement");
@ -111,7 +111,7 @@ int main()
static_assert(sqlpp::is_integral_t<T>::value, "type requirement");
static_assert(not sqlpp::is_floating_point_t<T>::value, "type requirement");
static_assert(sqlpp::is_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<T>::value, "type requirement");
static_assert(not sqlpp::require_insert_t<T>::value, "type requirement");
static_assert(sqlpp::must_not_insert_t<T>::value, "type requirement");
static_assert(sqlpp::must_not_update_t<T>::value, "type requirement");
@ -129,7 +129,7 @@ int main()
static_assert(not sqlpp::is_integral_t<T>::value, "type requirement");
static_assert(sqlpp::is_floating_point_t<T>::value, "type requirement");
static_assert(sqlpp::is_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<T>::value, "type requirement");
static_assert(not sqlpp::require_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_update_t<T>::value, "type requirement");
@ -145,7 +145,7 @@ int main()
using T = decltype(t.alpha.as(alias::a));
static_assert(sqlpp::is_numeric_t<T>::value, "type requirement");
static_assert(not sqlpp::is_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<T>::value, "type requirement");
static_assert(not sqlpp::require_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_update_t<T>::value, "type requirement");
@ -161,7 +161,7 @@ int main()
using T = decltype(select(t.alpha));
static_assert(sqlpp::is_numeric_t<T>::value, "type requirement");
static_assert(sqlpp::is_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<T>::value, "type requirement");
static_assert(not sqlpp::require_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_update_t<T>::value, "type requirement");
@ -179,7 +179,7 @@ int main()
//static_assert(sqlpp::is_from_t<decltype(T::_from)>::value, "Must not be noop");
static_assert(sqlpp::is_numeric_t<T>::value, "type requirement");
static_assert(sqlpp::is_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<T>::value, "type requirement");
static_assert(not sqlpp::require_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_update_t<T>::value, "type requirement");
@ -195,7 +195,7 @@ int main()
using T = decltype(select(t.alpha.as(alias::a)).from(t));
static_assert(sqlpp::is_numeric_t<T>::value, "type requirement");
static_assert(sqlpp::is_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<T>::value, "type requirement");
static_assert(not sqlpp::require_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_update_t<T>::value, "type requirement");
@ -211,7 +211,7 @@ int main()
using T = decltype(select(t.alpha).from(t).as(alias::b));
static_assert(not sqlpp::is_numeric_t<T>::value, "type requirement");
static_assert(not sqlpp::is_expression_t<T>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<T>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<T>::value, "type requirement");
static_assert(not sqlpp::require_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_update_t<T>::value, "type requirement");
@ -227,7 +227,7 @@ int main()
using T = decltype(select(t.alpha.as(alias::a)).from(t).as(alias::b));
static_assert(not sqlpp::is_numeric_t<T>::value, "type requirement");
static_assert(not sqlpp::is_expression_t<T>::value, "type requirement");
static_assert(not sqlpp::is_named_expression_t<T>::value, "type requirement");
static_assert(not sqlpp::is_selectable_t<T>::value, "type requirement");
static_assert(not sqlpp::require_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_insert_t<T>::value, "type requirement");
static_assert(not sqlpp::must_not_update_t<T>::value, "type requirement");
@ -243,7 +243,7 @@ int main()
using T = decltype(select(t.alpha).from(t).as(alias::b).alpha);
static_assert(sqlpp::is_numeric_t<T>::value, "type requirement");
static_assert(sqlpp::is_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<T>::value, "type requirement");
static_assert(not sqlpp::require_insert_t<T>::value, "type requirement");
static_assert(sqlpp::must_not_insert_t<T>::value, "type requirement");
static_assert(sqlpp::must_not_update_t<T>::value, "type requirement");
@ -259,7 +259,7 @@ int main()
using T = decltype(select(t.alpha.as(alias::a)).from(t).as(alias::b).a);
static_assert(sqlpp::is_numeric_t<T>::value, "type requirement");
static_assert(sqlpp::is_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_named_expression_t<T>::value, "type requirement");
static_assert(sqlpp::is_selectable_t<T>::value, "type requirement");
static_assert(not sqlpp::require_insert_t<T>::value, "type requirement");
static_assert(sqlpp::must_not_insert_t<T>::value, "type requirement");
static_assert(sqlpp::must_not_update_t<T>::value, "type requirement");
@ -364,8 +364,8 @@ int main()
static_assert(sqlpp::must_not_insert_t<decltype(t.alpha)>::value, "alpha must not be inserted");
serialize(t.alpha, printer).str();
std::cerr << "\n" << sizeof(test::TabBar) << std::endl;
static_assert(sqlpp::is_named_expression_t<decltype(t.alpha)>::value, "alpha should be a named expression");
static_assert(sqlpp::is_named_expression_t<decltype(t.alpha.as(alias::a))>::value, "an alias of alpha should be a named expression");
static_assert(sqlpp::is_selectable_t<decltype(t.alpha)>::value, "alpha should be a named expression");
static_assert(sqlpp::is_selectable_t<decltype(t.alpha.as(alias::a))>::value, "an alias of alpha should be a named expression");
static_assert(sqlpp::is_alias_t<decltype(t.alpha.as(alias::a))>::value, "an alias of alpha should be an alias");
auto l = t.as(alias::left);