diff --git a/include/sqlpp11/core/basic/schema_qualified_table.h b/include/sqlpp11/core/basic/schema_qualified_table.h index 345632ee..66f82098 100644 --- a/include/sqlpp11/core/basic/schema_qualified_table.h +++ b/include/sqlpp11/core/basic/schema_qualified_table.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include @@ -51,7 +51,7 @@ namespace sqlpp } template - typename Table::template _foreign_table_alias_t as( + typename Table::template _foreign_table_as_t as( const AliasProvider& /*unused*/) const { return {*this}; diff --git a/include/sqlpp11/core/basic/table.h b/include/sqlpp11/core/basic/table.h index 55533810..5859cfb0 100644 --- a/include/sqlpp11/core/basic/table.h +++ b/include/sqlpp11/core/basic/table.h @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include #include @@ -45,9 +45,9 @@ namespace sqlpp #warning: Need to inherit? //using _column_tuple_t = std::tuple...>; template - using _foreign_table_alias_t = table_alias_t; + using _foreign_table_as_t = table_as_t; template - using _sqlpp_name_tag = table_alias_t; + using _sqlpp_name_tag = table_as_t; template _sqlpp_name_tag as(const AliasProvider& /*unused*/) const diff --git a/include/sqlpp11/core/basic/table_alias.h b/include/sqlpp11/core/basic/table_as.h similarity index 74% rename from include/sqlpp11/core/basic/table_alias.h rename to include/sqlpp11/core/basic/table_as.h index 6baec4ab..325f309a 100644 --- a/include/sqlpp11/core/basic/table_alias.h +++ b/include/sqlpp11/core/basic/table_as.h @@ -36,8 +36,8 @@ namespace sqlpp { template - struct table_alias_t : public TableSpec::_table_columns>, - public enable_join> + struct table_as_t : public TableSpec::_table_columns>, + public enable_join> { using _nodes = detail::type_vector<>; using _required_ctes = required_ctes_of; @@ -50,29 +50,29 @@ namespace sqlpp }; template - struct is_table> : public std::true_type{}; + struct is_table> : public std::true_type{}; template - struct name_tag_of> : public name_tag_of{}; + struct name_tag_of> : public name_tag_of{}; template - struct provided_tables_of> + struct provided_tables_of> { - using type = sqlpp::detail::type_vector>; + using type = sqlpp::detail::type_vector>; }; template - struct provided_static_tables_of> : public provided_tables_of> + struct provided_static_tables_of> : public provided_tables_of> { }; template - struct provided_optional_tables_of> : public provided_tables_of> + struct provided_optional_tables_of> : public provided_tables_of> { }; template - auto to_sql_string(Context& context, const table_alias_t&) -> std::string + auto to_sql_string(Context& context, const table_as_t&) -> std::string { return name_to_sql_string(context, name_tag_of_t::name) + " AS " + name_to_sql_string(context, name_tag_of_t::name); diff --git a/include/sqlpp11/core/basic/verbatim_table.h b/include/sqlpp11/core/basic/verbatim_table.h index 22ab097d..2c8c004d 100644 --- a/include/sqlpp11/core/basic/verbatim_table.h +++ b/include/sqlpp11/core/basic/verbatim_table.h @@ -34,28 +34,28 @@ namespace sqlpp { template - struct verbatim_table_alias_t : public enable_join> + struct verbatim_table_as_t : public enable_join> { - verbatim_table_alias_t(std::string representation) : _representation(std::move(representation)) + verbatim_table_as_t(std::string representation) : _representation(std::move(representation)) { } - verbatim_table_alias_t(const verbatim_table_alias_t& rhs) = default; - verbatim_table_alias_t(verbatim_table_alias_t&& rhs) = default; - verbatim_table_alias_t& operator=(const verbatim_table_alias_t& rhs) = default; - verbatim_table_alias_t& operator=(verbatim_table_alias_t&& rhs) = default; - ~verbatim_table_alias_t() = default; + verbatim_table_as_t(const verbatim_table_as_t& rhs) = default; + verbatim_table_as_t(verbatim_table_as_t&& rhs) = default; + verbatim_table_as_t& operator=(const verbatim_table_as_t& rhs) = default; + verbatim_table_as_t& operator=(verbatim_table_as_t&& rhs) = default; + ~verbatim_table_as_t() = default; std::string _representation; }; template - struct is_table> : std::true_type + struct is_table> : std::true_type { }; template - auto to_sql_string(Context& context, const verbatim_table_alias_t& t) -> std::string + auto to_sql_string(Context& context, const verbatim_table_as_t& t) -> std::string { return t._representation + " AS " + name_to_sql_string(context, name_tag_of_t::name); } @@ -73,7 +73,7 @@ namespace sqlpp ~verbatim_table_t() = default; template - verbatim_table_alias_t as(const AliasProvider& /*unused*/) const + verbatim_table_as_t as(const AliasProvider& /*unused*/) const { return {_representation}; } diff --git a/tests/core/serialize/From.cpp b/tests/core/serialize/From.cpp index ee2c55ef..0f1d2d71 100644 --- a/tests/core/serialize/From.cpp +++ b/tests/core/serialize/From.cpp @@ -56,15 +56,10 @@ int From(int, char* []) " FROM tab_foo LEFT OUTER JOIN tab_bar ON tab_foo.double_n > tab_bar.id"); SQLPP_COMPARE(from(foo.right_outer_join(bar).on(foo.doubleN > bar.id)), " FROM tab_foo RIGHT OUTER JOIN tab_bar ON tab_foo.double_n > tab_bar.id"); - sqlpp::provided_tables_of_t::hansi; - sqlpp::required_tables_of_t bFoo.doubleN)>::hansi; -#warning: reactivate - /* SQLPP_COMPARE(from(aFoo.join(bFoo).on(aFoo.doubleN > bFoo.doubleN)), " FROM tab_foo AS a INNER JOIN tab_foo AS b ON a.double_n > b.double_n"); SQLPP_COMPARE(from(aFoo.join(bFoo).on(aFoo.doubleN > bFoo.doubleN).join(cFoo).on(bFoo.doubleN > cFoo.doubleN)), " FROM tab_foo AS a INNER JOIN tab_foo AS b ON a.double_n > b.double_n INNER JOIN tab_foo AS c ON b.double_n > c.double_n"); - SQLPP_COMPARE(from(foo.join(bar).unconditionally()), " FROM tab_foo INNER JOIN tab_bar"); // Static joins involving verbatim tables SQLPP_COMPARE(from(aFoo.join(sqlpp::verbatim_table("unknown_table")) @@ -81,6 +76,6 @@ int From(int, char* []) " FROM unknown_table AS a INNER JOIN another_table ON a.column_x > another_table.x"); #warning add tests for dynamic joins -*/ + return 0; } diff --git a/tests/core/serialize/basic/join.cpp b/tests/core/serialize/basic/join.cpp index 49033177..899c46c1 100644 --- a/tests/core/serialize/basic/join.cpp +++ b/tests/core/serialize/basic/join.cpp @@ -66,6 +66,7 @@ int main(int, char* []) #warning: Need to add tests with 3 tables #warning: Need to add tests with table aliases +#warning: Need to add tests with verbatim tables #warning: Need to add tests with sub selects #warning: Need to add tests with CTEs return 0;