From 7e32a0a3ea3e40cf18155b6d1b0ca3a6fd7d73ac Mon Sep 17 00:00:00 2001 From: rbock Date: Mon, 2 Jun 2014 07:48:05 +0200 Subject: [PATCH] Cleaned up minor as() method mess plus some oversights --- include/sqlpp11/avg.h | 3 ++- include/sqlpp11/basic_expression_operators.h | 4 ++++ include/sqlpp11/count.h | 3 ++- include/sqlpp11/exists.h | 3 ++- include/sqlpp11/functions.h | 3 ++- include/sqlpp11/max.h | 3 ++- include/sqlpp11/min.h | 3 ++- include/sqlpp11/select.h | 3 ++- include/sqlpp11/sum.h | 3 ++- include/sqlpp11/vendor/concat.h | 3 ++- include/sqlpp11/vendor/expression.h | 15 ++++++++++----- include/sqlpp11/vendor/extra_tables.h | 2 +- include/sqlpp11/vendor/from.h | 2 +- include/sqlpp11/vendor/in.h | 3 ++- include/sqlpp11/vendor/is_null.h | 3 ++- include/sqlpp11/vendor/like.h | 3 ++- include/sqlpp11/vendor/offset.h | 8 ++++---- include/sqlpp11/vendor/select_column_list.h | 2 ++ tests/CMakeLists.txt | 4 ++-- tests/SelectTypeTest.cpp | 11 +++++------ 20 files changed, 53 insertions(+), 31 deletions(-) diff --git a/include/sqlpp11/avg.h b/include/sqlpp11/avg.h index 2854a8d6..50ca491c 100644 --- a/include/sqlpp11/avg.h +++ b/include/sqlpp11/avg.h @@ -34,7 +34,8 @@ namespace sqlpp namespace vendor { template - struct avg_t: public floating_point::template expression_operators> + struct avg_t: public floating_point::template expression_operators>, + public alias_operators> { using _traits = make_traits; using _recursive_traits = make_recursive_traits; diff --git a/include/sqlpp11/basic_expression_operators.h b/include/sqlpp11/basic_expression_operators.h index e306542d..d1f06749 100644 --- a/include/sqlpp11/basic_expression_operators.h +++ b/include/sqlpp11/basic_expression_operators.h @@ -139,7 +139,11 @@ namespace sqlpp static_assert(detail::all_t<_is_valid_comparison_operand>::value...>::value, "at least one operand of in() is not valid"); return { *static_cast(this), vendor::wrap_operand_t{t}... }; } + }; + template + struct alias_operators + { template expression_alias_t as(const alias_provider&) { diff --git a/include/sqlpp11/count.h b/include/sqlpp11/count.h index eec747be..838189a6 100644 --- a/include/sqlpp11/count.h +++ b/include/sqlpp11/count.h @@ -35,7 +35,8 @@ namespace sqlpp namespace vendor { template - struct count_t: public sqlpp::detail::integral::template expression_operators> + struct count_t: public sqlpp::detail::integral::template expression_operators>, + public alias_operators> { using _traits = make_traits<::sqlpp::detail::integral, ::sqlpp::tag::expression, ::sqlpp::tag::named_expression>; using _recursive_traits = make_recursive_traits; diff --git a/include/sqlpp11/exists.h b/include/sqlpp11/exists.h index 7469af47..8d767754 100644 --- a/include/sqlpp11/exists.h +++ b/include/sqlpp11/exists.h @@ -34,7 +34,8 @@ namespace sqlpp namespace vendor { template - struct exists_t: public boolean::template expression_operators> + struct exists_t: public boolean::template expression_operators>, + public alias_operators> { using _traits = make_traits; using _recursive_traits = make_recursive_traits