From a5c8b40b077d517cd6c28db3e805cd2aa774c424 Mon Sep 17 00:00:00 2001 From: rbock Date: Mon, 9 Feb 2015 18:44:25 +0100 Subject: [PATCH] Adjust WITH clause to serialize RECURSIVE where required --- include/sqlpp11/with.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/sqlpp11/with.h b/include/sqlpp11/with.h index 399c94d8..fe3d7bda 100644 --- a/include/sqlpp11/with.h +++ b/include/sqlpp11/with.h @@ -45,6 +45,8 @@ namespace sqlpp template struct with_data_t { + using _is_recursive = logic::any_t; + with_data_t(Expressions... expressions): _expressions(expressions...) {} @@ -74,7 +76,6 @@ namespace sqlpp using _tags = detail::type_set<>; }; - using _is_dynamic = is_database; // Data @@ -172,6 +173,8 @@ namespace sqlpp { // FIXME: If there is a recursive CTE, add a "RECURSIVE" here context << " WITH "; + if (T::_is_recursive::value) + context << "RECURSIVE "; interpret_tuple(t._expressions, ',', context); return context; }