mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-16 04:47:18 +08:00
A few FIXME's regarding remaining stuff for with clauses and ctes
This commit is contained in:
parent
2adf529445
commit
aa9c8dcfce
@ -69,7 +69,7 @@ namespace sqlpp
|
|||||||
using make_cte_t = typename make_cte_impl<AliasProvider, Statement, get_result_row_t<Statement>>::type;
|
using make_cte_t = typename make_cte_impl<AliasProvider, Statement, get_result_row_t<Statement>>::type;
|
||||||
|
|
||||||
template<typename AliasProvider, typename Statement, typename... ColumnSpecs>
|
template<typename AliasProvider, typename Statement, typename... ColumnSpecs>
|
||||||
struct cte_t: public member_t<ColumnSpecs, column_t<AliasProvider, ColumnSpecs>>... // FIXME
|
struct cte_t: public member_t<ColumnSpecs, column_t<AliasProvider, ColumnSpecs>>...
|
||||||
{
|
{
|
||||||
using _traits = make_traits<no_value_t, tag::is_cte, tag::is_table>;
|
using _traits = make_traits<no_value_t, tag::is_cte, tag::is_table>;
|
||||||
struct _recursive_traits
|
struct _recursive_traits
|
||||||
@ -84,6 +84,9 @@ namespace sqlpp
|
|||||||
using _tags = detail::type_set<>;
|
using _tags = detail::type_set<>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// FIXME: need a union_distinct and union_all here
|
||||||
|
// unions can depend on the cte itself In that case the cte is recursive.
|
||||||
|
|
||||||
using _alias_t = typename AliasProvider::_alias_t;
|
using _alias_t = typename AliasProvider::_alias_t;
|
||||||
|
|
||||||
cte_t(Statement statement): _statement(statement){}
|
cte_t(Statement statement): _statement(statement){}
|
||||||
@ -124,6 +127,8 @@ namespace sqlpp
|
|||||||
-> make_cte_t<AliasProvider, Statement>
|
-> make_cte_t<AliasProvider, Statement>
|
||||||
{
|
{
|
||||||
// FIXME: Need to check stuff here.
|
// FIXME: Need to check stuff here.
|
||||||
|
// e.g. make sure that the statement does not require this a cte of this name (other ctes are allowed)
|
||||||
|
// make sure that the statement does not depend on external tables
|
||||||
return { statement };
|
return { statement };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -144,7 +144,8 @@ namespace sqlpp
|
|||||||
auto operator()(Statement statement)
|
auto operator()(Statement statement)
|
||||||
-> new_statement_t<true, typename Statement::_policies_t, no_with_t, with_t<Database, Expressions...>>
|
-> new_statement_t<true, typename Statement::_policies_t, no_with_t, with_t<Database, Expressions...>>
|
||||||
{
|
{
|
||||||
// FIXME need checks here, e.g. if there is recursion
|
// FIXME need checks here
|
||||||
|
// check that no cte refers to any of the ctes to the right
|
||||||
return { statement, _data };
|
return { statement, _data };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -158,6 +159,7 @@ namespace sqlpp
|
|||||||
|
|
||||||
static Context& _(const T& t, Context& context)
|
static Context& _(const T& t, Context& context)
|
||||||
{
|
{
|
||||||
|
// FIXME: If there is a recursive CTE, add a "RECURSIVE" here
|
||||||
context << " WITH ";
|
context << " WITH ";
|
||||||
interpret_tuple(t._expressions, ',', context);
|
interpret_tuple(t._expressions, ',', context);
|
||||||
return context;
|
return context;
|
||||||
|
Loading…
Reference in New Issue
Block a user