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

Dynamic select did not accept some non-dynamic clauses.

This commit is contained in:
rbock 2015-12-11 14:42:28 +01:00
parent 12eabd28f4
commit 333e55ea6d
6 changed files with 22 additions and 7 deletions

View File

@ -224,7 +224,7 @@ namespace sqlpp
template <typename Database, typename... Expressions>
auto _group_by_impl(const std::true_type&, Expressions... expressions) const
-> _new_statement_t<std::true_type, group_by_t<_database_t, Expressions...>>
-> _new_statement_t<std::true_type, group_by_t<Database, Expressions...>>
{
static_assert(not detail::has_duplicates<Expressions...>::value,
"at least one duplicate argument detected in group_by()");

View File

@ -222,7 +222,7 @@ namespace sqlpp
-> _new_statement_t<std::true_type, having_t<Database, Expressions...>>
{
return {static_cast<const derived_statement_t<Policies>&>(*this),
having_data_t<_database_t, Expressions...>{expressions...}};
having_data_t<Database, Expressions...>{expressions...}};
}
};
};

View File

@ -221,7 +221,7 @@ namespace sqlpp
template <typename Database, typename... Expressions>
auto _order_by_impl(const std::true_type&, Expressions... expressions) const
-> _new_statement_t<std::true_type, order_by_t<_database_t, Expressions...>>
-> _new_statement_t<std::true_type, order_by_t<Database, Expressions...>>
{
static_assert(not detail::has_duplicates<Expressions...>::value,
"at least one duplicate argument detected in order_by()");

View File

@ -217,7 +217,7 @@ namespace sqlpp
-> _new_statement_t<std::true_type, union_t<Database, Flag, derived_statement_t<Policies>, Rhs>>
{
return {blank_union_t{},
union_data_t<_database_t, Flag, derived_statement_t<Policies>, Rhs>{
union_data_t<Database, Flag, derived_statement_t<Policies>, Rhs>{
static_cast<const derived_statement_t<Policies>&>(*this), rhs}};
}
};

View File

@ -293,7 +293,7 @@ namespace sqlpp
-> _new_statement_t<std::true_type, where_t<Database, Expressions...>>
{
return {static_cast<const derived_statement_t<Policies>&>(*this),
where_data_t<_database_t, Expressions...>{expressions...}};
where_data_t<Database, Expressions...>{expressions...}};
}
};
};

View File

@ -115,6 +115,23 @@ int Select(int, char**)
.having(t.gamma)
.limit(7)
.offset(19);
printer.reset();
std::cerr << serialize(stat, printer).str() << std::endl;
auto s0 = dynamic_select(db)
.columns(all_of(t))
.flags(sqlpp::all)
.from(t)
.extra_tables(f, t)
.where(t.alpha > 0)
.group_by(t.alpha)
.order_by(t.gamma.asc())
.having(t.gamma)
.limit(7)
.offset(19);
printer.reset();
std::cerr << serialize(s0, printer).str() << std::endl;
auto s = dynamic_select(db)
.dynamic_columns(all_of(t))
@ -144,8 +161,6 @@ int Select(int, char**)
printer.reset();
std::cerr << serialize(s, printer).str() << std::endl;
printer.reset();
std::cerr << serialize(stat, printer).str() << std::endl;
select(sqlpp::value(7).as(t.alpha));