mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-16 04:47:18 +08:00
Added check to prevent multicolumns in sub selects
This commit is contained in:
parent
7900cba1ca
commit
0f9c1dbfb2
@ -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::named_expression>;
|
||||
using _traits = make_traits<no_value_t, tag::alias, tag::multi_column, tag::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");
|
||||
|
@ -269,6 +269,7 @@ namespace sqlpp
|
||||
_alias_t<AliasProvider> as(const AliasProvider& aliasProvider) const
|
||||
{
|
||||
static_assert(Policies::_can_be_used_as_table::value, "statement cannot be used as table, e.g. due to missing tables");
|
||||
static_assert(::sqlpp::detail::none_t<is_multi_column_t<Columns>::value...>::value, "cannot use multi-columns in sub selects");
|
||||
return _table_t<AliasProvider>(_get_statement()).as(aliasProvider);
|
||||
}
|
||||
|
||||
|
@ -290,11 +290,8 @@ int main()
|
||||
{
|
||||
auto m = multi_column(t.alpha, t.beta).as(alias::a);
|
||||
static_assert(not sqlpp::is_expression_t<decltype(m)>::value, "a multi_column is not a value");
|
||||
|
||||
#warning: A multicolumn cannot be used if the select is to be used like a table
|
||||
auto a = select(m).from(t).as(alias::b).a;
|
||||
//static_assert(not sqlpp::is_expression_t<decltype(a)>::value, "a multi_column is not a value");
|
||||
}
|
||||
|
||||
// Test that result sets with identical name/value combinations have identical types
|
||||
{
|
||||
auto a = select(t.alpha);
|
||||
|
Loading…
Reference in New Issue
Block a user