From 5e52a4da462bd18fac6a7515b9e159ac71855238 Mon Sep 17 00:00:00 2001 From: rbock Date: Sun, 25 Dec 2016 21:25:01 +0100 Subject: [PATCH] Added a few auto alias tests --- include/sqlpp11/not_in.h | 2 +- test_serializer/As.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/sqlpp11/not_in.h b/include/sqlpp11/not_in.h index 80676e64..eae91869 100644 --- a/include/sqlpp11/not_in.h +++ b/include/sqlpp11/not_in.h @@ -44,7 +44,7 @@ namespace sqlpp template struct _member_t { - T in; + T not_in; }; }; }; diff --git a/test_serializer/As.cpp b/test_serializer/As.cpp index 76c4dcfa..709148c1 100644 --- a/test_serializer/As.cpp +++ b/test_serializer/As.cpp @@ -44,5 +44,12 @@ int As(int, char* []) compare(__LINE__, (count(foo.omega) - bar.alpha).as(cheese), "(COUNT(tab_foo.omega)-tab_bar.alpha) AS cheese"); compare(__LINE__, (count(foo.omega) - uint32_t(17)).as(cheese), "(COUNT(tab_foo.omega)-17) AS cheese"); + // Auto alias + compare(__LINE__, select(max(bar.alpha)), "SELECT MAX(tab_bar.alpha) AS max_"); + compare(__LINE__, select(max(bar.alpha).as(cheese)), "SELECT MAX(tab_bar.alpha) AS cheese"); + compare(__LINE__, select(max(bar.alpha)).from(bar).unconditionally().as(cheese), + "(SELECT MAX(tab_bar.alpha) AS max_ FROM tab_bar) AS cheese"); + compare(__LINE__, select(max(bar.alpha)).from(bar).unconditionally().as(cheese).max, "cheese.max_"); + return 0; }