From 505adb546a3353dd6434e8ef822ae0ecc8f35378 Mon Sep 17 00:00:00 2001 From: Roland Bock Date: Tue, 23 Jul 2024 20:58:25 +0200 Subject: [PATCH] Fix incorrect for_update function, #583 --- include/sqlpp11/for_update.h | 5 ++--- tests/core/serialize/ForUpdate.cpp | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/sqlpp11/for_update.h b/include/sqlpp11/for_update.h index e4734797..f2832a48 100644 --- a/include/sqlpp11/for_update.h +++ b/include/sqlpp11/for_update.h @@ -162,9 +162,8 @@ namespace sqlpp return context; } - template - auto for_update(T&& t) -> decltype(statement_t().for_update(std::forward(t))) + inline auto for_update() -> decltype(statement_t().for_update()) { - return statement_t().for_update(std::forward(t)); + return statement_t().for_update(); } } // namespace sqlpp diff --git a/tests/core/serialize/ForUpdate.cpp b/tests/core/serialize/ForUpdate.cpp index 02bb5c9e..4d0e161c 100644 --- a/tests/core/serialize/ForUpdate.cpp +++ b/tests/core/serialize/ForUpdate.cpp @@ -51,6 +51,9 @@ int ForUpdate(int, char* []) const auto foo = test::TabFoo{}; // const auto bar = test::TabBar{}; + compare(__LINE__, sqlpp::for_update(), + " FOR UPDATE "); + // Unconditionally compare(__LINE__, select(foo.omega).from(foo).unconditionally().for_update(), "SELECT tab_foo.omega FROM tab_foo FOR UPDATE ");