mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-01-06 21:20:42 -06:00
Fix without_table_check for alias expressions
This commit is contained in:
@@ -27,9 +27,6 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef SQLPP_WITHOUT_TABLE_CHECK_H
|
||||
#define SQLPP_ALIAS_H
|
||||
|
||||
#include <sqlpp11/type_traits.h>
|
||||
#include <sqlpp11/serializer.h>
|
||||
|
||||
@@ -61,12 +58,11 @@ namespace sqlpp
|
||||
template <typename Expression>
|
||||
auto without_table_check(Expression expr) -> without_table_check_t<Expression>
|
||||
{
|
||||
static_assert(is_expression_t<Expression>::value, "invalid argument (expression expected)");
|
||||
static_assert(is_expression_t<Expression>::value or is_alias_t<Expression>::value,
|
||||
"invalid argument (expression or alias expression expected)");
|
||||
|
||||
return {expr};
|
||||
}
|
||||
} // namespace sqlpp
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -396,6 +396,12 @@ int SelectType(int, char* [])
|
||||
serialize(s, printer).str();
|
||||
}
|
||||
|
||||
{
|
||||
auto find_query = sqlpp::dynamic_select(db).dynamic_columns(t.alpha.as(alias::a)).dynamic_from(t).unconditionally();
|
||||
find_query.from.add(sqlpp::dynamic_join(f).on(t.alpha == f.omega));
|
||||
find_query.selected_columns.add(sqlpp::without_table_check(f.omega.as(alias::b)));
|
||||
}
|
||||
|
||||
// Test that verbatim_table compiles
|
||||
{
|
||||
auto s = select(t.alpha).from(sqlpp::verbatim_table("my_unknown_table"));
|
||||
|
||||
Reference in New Issue
Block a user