From 07fec62e3545253042ce1780a707df7bebc2d582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Fri, 19 Apr 2019 16:14:13 +1000 Subject: [PATCH] Better parsing for SET statements #2008 --- lib/set_parser.cpp | 1 + test/set_parser_test/setparsertest.cpp | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/set_parser.cpp b/lib/set_parser.cpp index facace7c7..ac00589f5 100644 --- a/lib/set_parser.cpp +++ b/lib/set_parser.cpp @@ -58,6 +58,7 @@ std::map> SetParser::parse() { } } else if (value4 != "") { // VARIABLE + value5.erase(value5.find_last_not_of(" \n\r\t\,")+1); key = value4; op.push_back(value5); } diff --git a/test/set_parser_test/setparsertest.cpp b/test/set_parser_test/setparsertest.cpp index 584288347..88cd437d0 100644 --- a/test/set_parser_test/setparsertest.cpp +++ b/test/set_parser_test/setparsertest.cpp @@ -139,11 +139,9 @@ TEST(TestParse, SET_NAMES) { static Test multiple[] = { { "SET time_zone = 'Europe/Paris', sql_mode = 'TRADITIONAL'", { Expected("time_zone", {"Europe/Paris"}), Expected("sql_mode", {"TRADITIONAL"}) } }, { "SET sql_mode = 'TRADITIONAL', NAMES 'utf8 COLLATE 'unicode_ci'", { Expected("sql_mode", {"TRADITIONAL"}), Expected("names", {"utf8", "unicode_ci"}) } }, -/* not supported by SetParser { "SET @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483", { Expected("sql_mode", {"CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO')"}), Expected("sql_auto_is_null", {"0"}), Expected("wait_timeout", {"2147483"}) } }, -*/ }; TEST(TestParse, MULTIPLE) {