mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
Added verbatim tables to join serialization tests
This commit is contained in:
parent
db2e36cb6e
commit
3be1ca1098
@ -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)),
|
__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)");
|
" 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<sqlpp::floating_point>("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<sqlpp::floating_point>("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<sqlpp::boolean>("a.column_x>another_table.x"))),
|
||||||
|
" FROM unknown_table AS a INNER JOIN another_table ON a.column_x>another_table.x");
|
||||||
|
|
||||||
// Dynamic joins
|
// Dynamic joins
|
||||||
const auto df = dynamic_from(db, foo);
|
const auto df = dynamic_from(db, foo);
|
||||||
compare(__LINE__, df, " FROM tab_foo");
|
compare(__LINE__, df, " FROM tab_foo");
|
||||||
@ -103,5 +117,13 @@ int From(int, char* [])
|
|||||||
"ON (tab_bar.alpha>a.omega)");
|
"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<sqlpp::floating_point>("unknown_table.column_x")));
|
||||||
|
compare(__LINE__, dfa, " FROM tab_foo INNER JOIN unknown_table ON (tab_bar.alpha>unknown_table.column_x)");
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user