From d6f5e498b9ce684fbf617ba2da567ecb9d0aaf67 Mon Sep 17 00:00:00 2001 From: Roland Bock Date: Tue, 23 Jul 2024 20:47:31 +0200 Subject: [PATCH] Fix incorrect expressions for paramterized_verbatim, #584 --- include/sqlpp11/parameterized_verbatim.h | 2 +- tests/core/usage/Select.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/sqlpp11/parameterized_verbatim.h b/include/sqlpp11/parameterized_verbatim.h index 456fb6b3..7956450f 100644 --- a/include/sqlpp11/parameterized_verbatim.h +++ b/include/sqlpp11/parameterized_verbatim.h @@ -35,7 +35,7 @@ namespace sqlpp { template - struct parameterized_verbatim_t : public expression_operators, ValueType>, + struct parameterized_verbatim_t : public expression_operators, ValueType>, public alias_operators> { using _traits = make_traits; diff --git a/tests/core/usage/Select.cpp b/tests/core/usage/Select.cpp index bb01f965..cce0e82f 100644 --- a/tests/core/usage/Select.cpp +++ b/tests/core/usage/Select.cpp @@ -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( + "ABS(field1 -", sqlpp::parameter(t.alpha), ")") <= + sqlpp::parameter(sqlpp::unsigned_integral(), param2))); + abs.params.alpha = 7; + abs.params.param2 = 7; + return 0; }