0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-15 20:31:16 +08:00

Remove aggregate attribute from trim()

This commit is contained in:
rbock 2019-08-28 09:42:48 +02:00
parent 4f9f001fbd
commit 5b2b175b21
2 changed files with 18 additions and 20 deletions

View File

@ -57,12 +57,11 @@ namespace sqlpp
}; };
template <typename Flag, typename Expr> template <typename Flag, typename Expr>
struct trim_t : public expression_operators<trim_t<Flag, Expr>, text>, struct trim_t : public expression_operators<trim_t<Flag, Expr>, text>, public alias_operators<trim_t<Flag, Expr>>
public alias_operators<trim_t<Flag, Expr>>
{ {
using _traits = make_traits<text, tag::is_expression, tag::is_selectable>; using _traits = make_traits<text, tag::is_expression, tag::is_selectable>;
using _nodes = detail::type_vector<Expr, aggregate_function>; using _nodes = detail::type_vector<Expr>;
using _can_be_null = can_be_null_t<Expr>; using _can_be_null = can_be_null_t<Expr>;
using _is_aggregate_expression = std::false_type; using _is_aggregate_expression = std::false_type;
@ -94,7 +93,6 @@ namespace sqlpp
context << ")"; context << ")";
return context; return context;
} }
}; };
template <typename T> template <typename T>

View File

@ -107,11 +107,12 @@ int Select(int, char* [])
std::cout << a << ", " << b << ", " << g << std::endl; std::cout << a << ", " << b << ", " << g << std::endl;
} }
for (const auto& row : db(select(all_of(t).as(t), t.gamma).from(t).where(t.alpha > 7).for_update())) for (const auto& row :
db(select(all_of(t), t.gamma.as(t)).from(t).where(t.alpha > 7 and trim(t.beta) == "test").for_update()))
{ {
int64_t a = row.tabBar.alpha; int64_t a = row.alpha;
const std::string b = row.tabBar.beta; const std::string b = row.beta;
const bool g = row.gamma; const bool g = row.tabBar;
std::cout << a << ", " << b << ", " << g << std::endl; std::cout << a << ", " << b << ", " << g << std::endl;
} }
@ -213,7 +214,6 @@ int Select(int, char* [])
{ {
std::cout << "Error: transaction isolation level does not match expected level" << std::endl; std::cout << "Error: transaction isolation level does not match expected level" << std::endl;
} }
} }
db.set_default_isolation_level(sqlpp::isolation_level::read_uncommitted); db.set_default_isolation_level(sqlpp::isolation_level::read_uncommitted);
{ {