Skip to content

Commit

Permalink
Fix incorrect expressions for paramterized_verbatim, #584
Browse files Browse the repository at this point in the history
  • Loading branch information
rbock committed Jul 23, 2024
1 parent 166b01a commit d6f5e49
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/sqlpp11/parameterized_verbatim.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down
9 changes: 9 additions & 0 deletions tests/core/usage/Select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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*[])
{
Expand Down Expand Up @@ -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;
}

0 comments on commit d6f5e49

Please sign in to comment.