From 437607813c7c4b422c2db7eedcdbc4466a5f5399 Mon Sep 17 00:00:00 2001 From: rbock Date: Sun, 15 Feb 2015 16:54:03 +0100 Subject: [PATCH] Table aliases must not use braces for tables but for sub selects --- include/sqlpp11/table_alias.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/sqlpp11/table_alias.h b/include/sqlpp11/table_alias.h index 4985a875..c94557f9 100644 --- a/include/sqlpp11/table_alias.h +++ b/include/sqlpp11/table_alias.h @@ -74,9 +74,12 @@ namespace sqlpp static Context& _(const T& t, Context& context) { - context << "("; + if (requires_braces_t::value) + context << "("; serialize(t._table, context); - context << ") AS " << name_of::char_ptr(); + if (requires_braces_t::value) + context << ")"; + context << " AS " << name_of::char_ptr(); return context; } };