diff --git a/include/sqlpp11/result_row.h b/include/sqlpp11/result_row.h index 509a9acd..150e5101 100644 --- a/include/sqlpp11/result_row.h +++ b/include/sqlpp11/result_row.h @@ -28,7 +28,7 @@ #define SQLPP_RESULT_ROW_H #include -#include +#include #include namespace sqlpp { @@ -59,7 +59,7 @@ namespace sqlpp }; template - struct result_row_impl>, Rest...>: + struct result_row_impl>, Rest...>: public AliasProvider::template _member_t>, // level prevents identical closures to be present twice in the inheritance tree public result_row_impl { diff --git a/include/sqlpp11/select.h b/include/sqlpp11/select.h index 7c31177f..62a67703 100644 --- a/include/sqlpp11/select.h +++ b/include/sqlpp11/select.h @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -102,7 +103,7 @@ namespace sqlpp using add_limit_t = select_t; using add_offset_t = select_t; - using _result_row_t = result_row_t; + using _result_row_t = result_row_t...>; // Indicators using _value_type = typename std::conditional< diff --git a/tests/SelectTest.cpp b/tests/SelectTest.cpp index 027a9fc2..2aef3709 100644 --- a/tests/SelectTest.cpp +++ b/tests/SelectTest.cpp @@ -38,6 +38,7 @@ DbMock db; int main() { TabSample t; + TabFoo f; // Test a table { @@ -249,6 +250,17 @@ int main() static_assert(not sqlpp::is_value_t::value, "a multi_column is not a value"); } + // Test that result sets with identical name/value combinations have identical types + { + auto a = select(t.alpha); + auto b = select(f.omega.as(t.alpha)); + using A = typename decltype(a)::_result_row_t; + using B = typename decltype(b)::_result_row_t; + static_assert(std::is_same::value, "Two bigint columns must have identical base_value_type"); + //A x = std::declval(); + static_assert(std::is_same::value, "select with identical columns(name/value_type) need to have identical result_types"); + } + static_assert(sqlpp::is_select_flag_t::value, "sqlpp::all has to be a select_flag"); using T = sqlpp::detail::wrap_operand::type;