mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-01-01 10:41:22 -06:00
Loosen union constraints a bit more
This commit is contained in:
@@ -46,7 +46,10 @@ namespace sqlpp
|
||||
static constexpr auto is_compatible(field_spec_t<N, V, C, T>) -> bool
|
||||
{
|
||||
using rhs = field_spec_t<N, V, C, T>;
|
||||
return std::is_same<_traits, typename rhs::_traits>::value and
|
||||
return std::is_same<ValueType, V>::value and // We might need to know that float can hold int, too
|
||||
(CanBeNull or CanBeNull == C) and // The left hand side determines the result row and therefore must allow
|
||||
// NULL if the right hand side allows it
|
||||
(NullIsTrivialValue or NullIsTrivialValue == T) and
|
||||
std::is_same<typename _alias_t::_name_t, typename rhs::_alias_t::_name_t>::value;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -218,9 +218,6 @@ namespace sqlpp
|
||||
constexpr auto vec_rhs = detail::type_vector<rhs_result_row_t>{};
|
||||
static_assert(lhs_result_row_t::is_compatible(vec_rhs),
|
||||
"both arguments in a union have to have the same result columns (type and name)");
|
||||
static_assert(
|
||||
is_static_result_row_t<lhs_result_row_t>::value && is_static_result_row_t<rhs_result_row_t>::value,
|
||||
"unions must not have dynamically added columns");
|
||||
|
||||
return _union_impl<void, union_distinct_t>(check_union_t<derived_statement_t<Policies>, Rhs>{}, rhs);
|
||||
}
|
||||
@@ -240,9 +237,6 @@ namespace sqlpp
|
||||
constexpr auto vec_rhs = detail::type_vector<rhs_result_row_t>{};
|
||||
static_assert(lhs_result_row_t::is_compatible(vec_rhs),
|
||||
"both arguments in a union have to have the same result columns (type and name)");
|
||||
static_assert(
|
||||
is_static_result_row_t<lhs_result_row_t>::value && is_static_result_row_t<rhs_result_row_t>::value,
|
||||
"unions must not have dynamically added columns");
|
||||
|
||||
return _union_impl<void, union_all_t>(check_union_t<derived_statement_t<Policies>, Rhs>{}, rhs);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user