From 5ccd4154f6a714030023c38a1d1a7afe79bc3897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Mon, 11 Sep 2023 17:29:35 +0000 Subject: [PATCH] Remove trailing spaces and semicolon from SET statements #4341 --- lib/set_parser.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/set_parser.cpp b/lib/set_parser.cpp index fe61f91c0e..729dfa6c2c 100644 --- a/lib/set_parser.cpp +++ b/lib/set_parser.cpp @@ -79,6 +79,8 @@ std::map> SetParser::parse1() { re2::RE2 re0("^\\s*SET\\s+", *opt2); re2::RE2::Replace(&query, re0, ""); + re2::RE2 re1("(\\s|;)+$", *opt2); // remove trailing spaces and semicolon + re2::RE2::Replace(&query, re1, ""); std::map> result; @@ -359,6 +361,9 @@ std::map> SetParser::parse1v2() { re2::RE2 re0("^\\s*SET\\s+", *parse1v2_opt2); re2::RE2::Replace(&query, re0, ""); + re2::RE2 re1("(\\s|;)+$", *parse1v2_opt2); // remove trailing spaces and semicolon + re2::RE2::Replace(&query, re1, ""); + VALGRIND_ENABLE_ERROR_REPORTING; std::string var; std::string value1, value2, value3, value4, value5;