diff --git a/test_serializer/From.cpp b/test_serializer/From.cpp index a7978ea3..f10c1d6a 100644 --- a/test_serializer/From.cpp +++ b/test_serializer/From.cpp @@ -62,6 +62,20 @@ int From(int, char* []) __LINE__, from(aFoo.join(bFoo).on(aFoo.omega > bFoo.omega).join(cFoo).on(bFoo.omega > cFoo.omega)), " FROM tab_foo AS a INNER JOIN tab_foo AS b ON (a.omega>b.omega) INNER JOIN tab_foo AS c ON (b.omega>c.omega)"); + // Static joins involving verbatim tables + compare(__LINE__, from(aFoo.join(sqlpp::verbatim_table("unknown_table")) + .on(aFoo.omega > sqlpp::verbatim("unknown_table.column_x"))), + " FROM tab_foo AS a INNER JOIN unknown_table ON (a.omega>unknown_table.column_x)"); + compare(__LINE__, from(sqlpp::verbatim_table("unknown_table") + .join(aFoo) + .on(aFoo.omega > sqlpp::verbatim("unknown_table.column_x"))), + " FROM unknown_table INNER JOIN tab_foo AS a ON (a.omega>unknown_table.column_x)"); + compare(__LINE__, from(sqlpp::verbatim_table("unknown_table") + .as(sqlpp::alias::a) + .join(sqlpp::verbatim_table("another_table")) + .on(sqlpp::verbatim("a.column_x>another_table.x"))), + " FROM unknown_table AS a INNER JOIN another_table ON a.column_x>another_table.x"); + // Dynamic joins const auto df = dynamic_from(db, foo); compare(__LINE__, df, " FROM tab_foo"); @@ -103,5 +117,13 @@ int From(int, char* []) "ON (tab_bar.alpha>a.omega)"); } + // Dynamic joins involving verbatim table + { + auto dfa = df; + dfa.from.add(dynamic_inner_join(sqlpp::verbatim_table("unknown_table")) + .on(bar.alpha > sqlpp::verbatim("unknown_table.column_x"))); + compare(__LINE__, dfa, " FROM tab_foo INNER JOIN unknown_table ON (tab_bar.alpha>unknown_table.column_x)"); + } + return 0; }