From aa9c8dcfce406527d16b059d7444892d536b39ad Mon Sep 17 00:00:00 2001 From: rbock Date: Sat, 7 Feb 2015 14:42:29 +0100 Subject: [PATCH] A few FIXME's regarding remaining stuff for with clauses and ctes --- include/sqlpp11/cte.h | 7 ++++++- include/sqlpp11/with.h | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/sqlpp11/cte.h b/include/sqlpp11/cte.h index 86aea573..fd40f789 100644 --- a/include/sqlpp11/cte.h +++ b/include/sqlpp11/cte.h @@ -69,7 +69,7 @@ namespace sqlpp using make_cte_t = typename make_cte_impl>::type; template - struct cte_t: public member_t>... // FIXME + struct cte_t: public member_t>... { using _traits = make_traits; struct _recursive_traits @@ -84,6 +84,9 @@ namespace sqlpp 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; cte_t(Statement statement): _statement(statement){} @@ -124,6 +127,8 @@ namespace sqlpp -> make_cte_t { // 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 }; } }; diff --git a/include/sqlpp11/with.h b/include/sqlpp11/with.h index 63ecf249..95dd3e68 100644 --- a/include/sqlpp11/with.h +++ b/include/sqlpp11/with.h @@ -144,7 +144,8 @@ namespace sqlpp auto operator()(Statement statement) -> new_statement_t> { - // 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 }; } }; @@ -158,6 +159,7 @@ namespace sqlpp static Context& _(const T& t, Context& context) { + // FIXME: If there is a recursive CTE, add a "RECURSIVE" here context << " WITH "; interpret_tuple(t._expressions, ',', context); return context;