mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-16 04:47:18 +08:00
Added extra_tables to recursive_traits
This commit is contained in:
parent
5f4a88c7ce
commit
6972758931
@ -48,8 +48,10 @@ namespace sqlpp
|
|||||||
using _traits = make_traits<typename ColumnSpec::_value_type, tag::column, tag::expression, tag::named_expression>;
|
using _traits = make_traits<typename ColumnSpec::_value_type, tag::column, tag::expression, tag::named_expression>;
|
||||||
struct _recursive_traits
|
struct _recursive_traits
|
||||||
{
|
{
|
||||||
|
using _parameters = std::tuple<>;
|
||||||
using _provided_tables = detail::type_set<>;
|
using _provided_tables = detail::type_set<>;
|
||||||
using _required_tables = detail::type_set<Table>;
|
using _required_tables = detail::type_set<Table>;
|
||||||
|
using _extra_tables = detail::type_set<>;
|
||||||
};
|
};
|
||||||
|
|
||||||
using _spec_t = ColumnSpec;
|
using _spec_t = ColumnSpec;
|
||||||
|
@ -37,7 +37,13 @@ namespace sqlpp
|
|||||||
struct parameter_t: public ValueType::template expression_operators<parameter_t<ValueType, NameType>>
|
struct parameter_t: public ValueType::template expression_operators<parameter_t<ValueType, NameType>>
|
||||||
{
|
{
|
||||||
using _traits = make_traits<ValueType, tag::parameter, tag::expression>;
|
using _traits = make_traits<ValueType, tag::parameter, tag::expression>;
|
||||||
using _recursive_traits = make_recursive_traits<>;
|
struct _recursive_traits
|
||||||
|
{
|
||||||
|
using _parameters = std::tuple<parameter_t>;
|
||||||
|
using _provided_tables = detail::type_set<>;
|
||||||
|
using _required_tables = detail::type_set<>;
|
||||||
|
using _extra_tables = detail::type_set<>;
|
||||||
|
};
|
||||||
|
|
||||||
using _instance_t = typename NameType::_name_t::template _member_t<typename ValueType::_parameter_t>;
|
using _instance_t = typename NameType::_name_t::template _member_t<typename ValueType::_parameter_t>;
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ namespace sqlpp
|
|||||||
static_assert(is_noop_t<ColumnList>::value or sqlpp::is_select_column_list_t<ColumnList>::value, "column list of select is neither naught nor a valid column list");
|
static_assert(is_noop_t<ColumnList>::value or sqlpp::is_select_column_list_t<ColumnList>::value, "column list of select is neither naught nor a valid column list");
|
||||||
static_assert(is_noop_t<From>::value or sqlpp::is_from_t<From>::value, "from() part of select is neither naught nor a valid from()");
|
static_assert(is_noop_t<From>::value or sqlpp::is_from_t<From>::value, "from() part of select is neither naught nor a valid from()");
|
||||||
|
|
||||||
using _known_tables = detail::make_joined_set_t<provided_tables_of<_from_t>, provided_tables_of<_extra_tables_t>>; // FIXME, use provided_tables_of<THIS>;
|
using _known_tables = detail::make_joined_set_t<provided_tables_of<_from_t>, extra_tables_of<_extra_tables_t>>;
|
||||||
|
|
||||||
template<typename Expression>
|
template<typename Expression>
|
||||||
using _no_unknown_tables = detail::is_subset_of<required_tables_of<Expression>, _known_tables>;
|
using _no_unknown_tables = detail::is_subset_of<required_tables_of<Expression>, _known_tables>;
|
||||||
|
@ -49,6 +49,7 @@ namespace sqlpp
|
|||||||
using _parameters = std::tuple<>;
|
using _parameters = std::tuple<>;
|
||||||
using _required_tables = detail::type_set<>;
|
using _required_tables = detail::type_set<>;
|
||||||
using _provided_tables = detail::type_set<Table>;
|
using _provided_tables = detail::type_set<Table>;
|
||||||
|
using _extra_tables = detail::type_set<>;
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof...(ColumnSpec), "at least one column required per table");
|
static_assert(sizeof...(ColumnSpec), "at least one column required per table");
|
||||||
|
@ -162,6 +162,12 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
using type = typename T::_recursive_traits::_provided_tables;
|
using type = typename T::_recursive_traits::_provided_tables;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct extra_table_of_impl
|
||||||
|
{
|
||||||
|
using type = typename T::_recursive_traits::_extra_tables;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
template<typename T>
|
template<typename T>
|
||||||
using value_type_of = typename detail::value_type_of_impl<T>::type;
|
using value_type_of = typename detail::value_type_of_impl<T>::type;
|
||||||
@ -172,6 +178,9 @@ namespace sqlpp
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
using provided_tables_of = typename detail::provided_table_of_impl<T>::type;
|
using provided_tables_of = typename detail::provided_table_of_impl<T>::type;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
using extra_tables_of = typename detail::extra_table_of_impl<T>::type;
|
||||||
|
|
||||||
template<typename ValueType, typename... Tags>
|
template<typename ValueType, typename... Tags>
|
||||||
struct make_traits
|
struct make_traits
|
||||||
{
|
{
|
||||||
@ -183,6 +192,7 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
using _required_tables = detail::make_joined_set_t<required_tables_of<Arguments>...>;
|
using _required_tables = detail::make_joined_set_t<required_tables_of<Arguments>...>;
|
||||||
using _provided_tables = detail::make_joined_set_t<provided_tables_of<Arguments>...>;
|
using _provided_tables = detail::make_joined_set_t<provided_tables_of<Arguments>...>;
|
||||||
|
using _extra_tables = detail::make_joined_set_t<extra_tables_of<Arguments>...>;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
8
include/sqlpp11/vendor/extra_tables.h
vendored
8
include/sqlpp11/vendor/extra_tables.h
vendored
@ -40,6 +40,14 @@ namespace sqlpp
|
|||||||
struct extra_tables_t
|
struct extra_tables_t
|
||||||
{
|
{
|
||||||
using _traits = make_traits<no_value_t, ::sqlpp::tag::extra_tables>;
|
using _traits = make_traits<no_value_t, ::sqlpp::tag::extra_tables>;
|
||||||
|
struct _recursive_traits
|
||||||
|
{
|
||||||
|
using _parameters = std::tuple<>;
|
||||||
|
using _required_tables = ::sqlpp::detail::type_set<>;
|
||||||
|
using _provided_tables = ::sqlpp::detail::type_set<>;
|
||||||
|
using _extra_tables = ::sqlpp::detail::type_set<Tables...>;
|
||||||
|
};
|
||||||
|
|
||||||
using _recursive_traits = make_recursive_traits<Tables...>;
|
using _recursive_traits = make_recursive_traits<Tables...>;
|
||||||
|
|
||||||
// FIXME: extra_tables must not require tables!
|
// FIXME: extra_tables must not require tables!
|
||||||
|
Loading…
Reference in New Issue
Block a user