diff --git a/include/sqlpp11/field_spec.h b/include/sqlpp11/field_spec.h index 65320dd4..53d6189f 100644 --- a/include/sqlpp11/field_spec.h +++ b/include/sqlpp11/field_spec.h @@ -41,17 +41,6 @@ namespace sqlpp using _nodes = detail::type_vector<>; using _alias_t = NameType; - - template - static constexpr auto is_compatible(field_spec_t) -> bool - { - using rhs = field_spec_t; - return std::is_same::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::value; - } }; template @@ -64,19 +53,39 @@ namespace sqlpp template struct multi_field_spec_t> { - template - static constexpr auto is_compatible(multi_field_spec_t) -> - typename std::enable_if::type - { - return logic::all_t::value; - } + }; - template - static constexpr auto is_compatible(multi_field_spec_t) -> - typename std::enable_if::type - { - return false; - } + template + struct is_field_compatible + { + static constexpr auto value = false; + }; + + template + struct is_field_compatible, + field_spec_t> + { + static constexpr auto value = + std::is_same::value and + std::is_same::value and // Same value type + (LeftCanBeNull or !RightCanBeNull) and // The left hand side determines the result row and therefore must allow + // NULL if the right hand side allows it + (LeftNullIsTrivial or !RightNullIsTrivial); // as above + }; + + template + struct is_field_compatible>, + multi_field_spec_t>, + typename std::enable_if::type> + { + static constexpr auto value = logic::all_t::value...>::value; }; namespace detail diff --git a/include/sqlpp11/result_row.h b/include/sqlpp11/result_row.h index bebe78dd..8c620322 100644 --- a/include/sqlpp11/result_row.h +++ b/include/sqlpp11/result_row.h @@ -262,7 +262,7 @@ namespace sqlpp result_row_t, typename std::enable_if::type> { - static constexpr auto value = logic::all_t::value; + static constexpr auto value = logic::all_t::value...>::value; }; template diff --git a/include/sqlpp11/union.h b/include/sqlpp11/union.h index 624e5ff2..dd15400d 100644 --- a/include/sqlpp11/union.h +++ b/include/sqlpp11/union.h @@ -253,6 +253,7 @@ namespace sqlpp }; }; + /* template auto union_all(T&& t) -> decltype(statement_t().union_all(std::forward(t))) { @@ -264,6 +265,7 @@ namespace sqlpp { return statement_t().union_distinct(std::forward(t)); } + */ } #endif