diff --git a/lib/set_parser.cpp b/lib/set_parser.cpp index 008528bc8..cc86aaf02 100644 --- a/lib/set_parser.cpp +++ b/lib/set_parser.cpp @@ -29,7 +29,7 @@ std::map> SetParser::parse() { std::map> result; #define NAMES "(NAMES)" -#define QUOTES "(?:'||\")" +#define QUOTES "(?:'|\")?" #define NAME_VALUE "((?:\\w|\\d)+)" #define SESSION "(?:|SESSION +|@@|@@session.)" #define VAR "(\\w+)" diff --git a/test/set_parser_test/Makefile b/test/set_parser_test/Makefile index acb6cee0e..c7d3c3562 100644 --- a/test/set_parser_test/Makefile +++ b/test/set_parser_test/Makefile @@ -39,7 +39,7 @@ LIBPROXYSQLAR=$(LDIR)/libproxysql.a MYCPPFLAGS=-std=c++11 $(IDIRS) $(OPTZ) $(DEBUG) -ggdb LDFLAGS+= -MYLIBS=-Wl,--export-dynamic -Wl,-Bstatic -lconfig -lproxysql -ldaemon -ljemalloc -lconfig++ -lre2 -levent -lmariadbclient -Wl,-Bdynamic -lpthread -lm -lz -lrt -lcrypto -lssl $(EXTRALINK) +MYLIBS=-Wl,--export-dynamic -Wl,-Bstatic -lproxysql -ldaemon -ljemalloc -lre2 -lmariadbclient -Wl,-Bdynamic -lpthread -lm -lz -lrt -lcrypto -lssl $(EXTRALINK) ifeq ($(UNAME_S),Darwin) MYLIBS=-lre2 -lpthread -lm -lz -liconv diff --git a/test/set_parser_test/setparsertest b/test/set_parser_test/setparsertest new file mode 100755 index 000000000..8e108a099 Binary files /dev/null and b/test/set_parser_test/setparsertest differ diff --git a/test/set_parser_test/setparsertest.cpp b/test/set_parser_test/setparsertest.cpp index 0c3a31361..1fbf0e4fe 100644 --- a/test/set_parser_test/setparsertest.cpp +++ b/test/set_parser_test/setparsertest.cpp @@ -80,6 +80,7 @@ static Test sql_mode[] = { { "SET sql_mode = 'TRADITIONAL'", { Expected("sql_mode", {"TRADITIONAL"}) } }, { "SET SQL_MODE ='TRADITIONAL'", { Expected("sql_mode", {"TRADITIONAL"}) } }, { "SET SQL_MODE = \"TRADITIONAL\"", { Expected("sql_mode", {"TRADITIONAL"}) } }, + { "SET SQL_MODE = TRADITIONAL", { Expected("sql_mode", {"TRADITIONAL"}) } }, }; void TestParse(const Test* tests, int ntests, const string& title) { @@ -107,6 +108,9 @@ TEST(TestParse, SET_SQL_MODE) { static Test time_zone[] = { { "SET @@time_zone = 'Europe/Paris'", { Expected("time_zone", {"Europe/Paris"}) } }, + { "SET @@time_zone = '+00:00'", { Expected("time_zone", {"+00:00"}) } }, + { "SET @@time_zone = \"Europe/Paris\"", { Expected("time_zone", {"Europe/Paris"}) } }, + { "SET @@time_zone = \"+00:00\"", { Expected("time_zone", {"+00:00"}) } }, }; TEST(TestParse, SET_TIME_ZONE) {