0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-16 04:47:18 +08:00

Fix incorrect expressions for paramterized_verbatim, #584

This commit is contained in:
Roland Bock 2024-07-23 20:47:31 +02:00
parent 166b01a32f
commit d6f5e498b9
2 changed files with 10 additions and 1 deletions

View File

@ -35,7 +35,7 @@
namespace sqlpp
{
template <typename ValueType, typename Expr>
struct parameterized_verbatim_t : public expression_operators<verbatim_t<ValueType>, ValueType>,
struct parameterized_verbatim_t : public expression_operators<parameterized_verbatim_t<ValueType, Expr>, ValueType>,
public alias_operators<verbatim_t<ValueType>>
{
using _traits = make_traits<ValueType, tag::is_expression>;

View File

@ -62,6 +62,8 @@ void print_row(Row const& row)
}
SQLPP_ALIAS_PROVIDER(cheese)
SQLPP_ALIAS_PROVIDER(param1)
SQLPP_ALIAS_PROVIDER(param2)
int Select(int, char*[])
{
@ -219,5 +221,12 @@ int Select(int, char*[])
std::cout << row.omega << " " << row.cheese << std::endl;
}
// checking #584
auto abs = db.prepare(select(t.alpha).from(t).where(sqlpp::parameterized_verbatim<sqlpp::unsigned_integral>(
"ABS(field1 -", sqlpp::parameter(t.alpha), ")") <=
sqlpp::parameter(sqlpp::unsigned_integral(), param2)));
abs.params.alpha = 7;
abs.params.param2 = 7;
return 0;
}