From 6f056ced8a246f5abbc72d6904e581e4230e24d3 Mon Sep 17 00:00:00 2001 From: rbock Date: Thu, 24 Jul 2014 17:36:56 +0200 Subject: [PATCH] Transport can_be_null into subselect used as a result column --- include/sqlpp11/select_column_list.h | 1 - include/sqlpp11/statement.h | 12 ++++++++++-- include/sqlpp11/verbatim_table.h | 6 +++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/include/sqlpp11/select_column_list.h b/include/sqlpp11/select_column_list.h index 398cc1e5..0aab60ff 100644 --- a/include/sqlpp11/select_column_list.h +++ b/include/sqlpp11/select_column_list.h @@ -54,7 +54,6 @@ namespace sqlpp template struct select_traits { -#warning need to transport the "can be null information here" using _traits = make_traits, tag::select_column_list, tag::return_value, tag::expression, tag::named_expression>; using _name_t = typename Column::_name_t; }; diff --git a/include/sqlpp11/statement.h b/include/sqlpp11/statement.h index 13e88e64..4d72757b 100644 --- a/include/sqlpp11/statement.h +++ b/include/sqlpp11/statement.h @@ -112,7 +112,12 @@ namespace sqlpp using _provided_outer_tables = detail::type_set<>; using _extra_tables = detail::type_set<>; using _parameters = detail::make_parameter_tuple_t...>; - using _can_be_null = detail::any_t::value>; + using _can_be_null = detail::any_t< + can_be_null_t<_result_type_provider>::value, + ::sqlpp::detail::make_intersect_set_t< + required_tables_of<_result_type_provider>, + provided_outer_tables_of + >::size::value>; }; }; } @@ -128,7 +133,10 @@ namespace sqlpp { using _policies_t = typename detail::statement_policies_t; - using _traits = make_traits, ::sqlpp::tag::select, tag::expression_if, tag::named_expression_if>; + using _traits = make_traits, + ::sqlpp::tag::select, + tag::expression_if, + tag::named_expression_if>; using _recursive_traits = typename _policies_t::_recursive_traits; using _used_outer_tables = typename _policies_t::_all_provided_outer_tables; diff --git a/include/sqlpp11/verbatim_table.h b/include/sqlpp11/verbatim_table.h index 0c7f6576..2e5fa27c 100644 --- a/include/sqlpp11/verbatim_table.h +++ b/include/sqlpp11/verbatim_table.h @@ -46,9 +46,13 @@ namespace sqlpp }; } -#warning a verbatim table is always an outer table struct verbatim_table_t: public sqlpp::table_t { + struct _recursive_traits: public sqlpp::table_t::_recursive_traits + { + using _provided_outer_tables = detail::type_set; + }; + struct _name_t {}; verbatim_table_t(std::string representation):