diff --git a/lib/set_parser.cpp b/lib/set_parser.cpp index 807daef213..05267ee8ee 100644 --- a/lib/set_parser.cpp +++ b/lib/set_parser.cpp @@ -71,8 +71,9 @@ void SetParser::set_query(const std::string& nq) { #define VAR_VALUE_P1 "(" VAR_VALUE_P1_1 VAR_VALUE_P1_2 VAR_VALUE_P1_3 VAR_VALUE_P1_4 VAR_VALUE_P1_5 VAR_VALUE_P1_6 ")" std::map> SetParser::parse1() { - +#ifdef DEBUG proxy_debug(PROXY_DEBUG_MYSQL_QUERY_PROCESSOR, 4, "Parsing query %s\n", query.c_str()); +#endif // DEBUG re2::RE2::Options *opt2=new re2::RE2::Options(RE2::Quiet); opt2->set_case_sensitive(false); opt2->set_longest_match(false); @@ -83,9 +84,13 @@ std::map> SetParser::parse1() { std::map> result; const std::string pattern="(?:" NAMES SPACES QUOTES NAME_VALUE QUOTES "(?: +COLLATE +" QUOTES NAME_VALUE QUOTES "|)" "|" SESSION_P1 VAR_P1 SPACES "(?:|:)=" SPACES QUOTES VAR_VALUE_P1 QUOTES ") *,? *"; +#ifdef DEBUG VALGRIND_DISABLE_ERROR_REPORTING; +#endif // DEBUG re2::RE2 re(pattern, *opt2); +#ifdef DEBUG VALGRIND_ENABLE_ERROR_REPORTING; +#endif // DEBUG std::string var; std::string value1, value2, value3, value4, value5; re2::StringPiece input(query); @@ -267,9 +272,10 @@ void SetParser::generateRE_parse1v2() { var_value += s; } var_value += ")"; - +#ifdef DEBUG proxy_debug(PROXY_DEBUG_MYSQL_QUERY_PROCESSOR, 4, "Parsing query %s\n", query.c_str()); +#endif // DEBUG parse1v2_opt2 = new re2::RE2::Options(RE2::Quiet); parse1v2_opt2->set_case_sensitive(false); parse1v2_opt2->set_longest_match(false); @@ -317,7 +323,9 @@ void SetParser::generateRE_parse1v2() { //const std::string pattern="(?:" NAMES SPACES QUOTES NAME_VALUE QUOTES "(?: +COLLATE +" QUOTES NAME_VALUE QUOTES "|)" "|" SESSION_P1 VAR_P1 SPACES "(?:|:)=" SPACES QUOTES VAR_VALUE_P1 QUOTES ") *,? *"; const std::string pattern="(?:" NAMES SPACES + name_value + "(?: +COLLATE +" + name_value + "|)" "|" + var_1 + SPACES "(?:|:)=" SPACES + var_value + ") *,? *"; //const std::string pattern=var_1 + SPACES "(?:|:)=" SPACES + var_value; +#ifdef DEBUG VALGRIND_DISABLE_ERROR_REPORTING; +#endif // DEBUG #ifdef PARSERDEBUG if (verbosity > 0) { cout << pattern << endl; @@ -339,7 +347,9 @@ std::map> SetParser::parse1v2() { re2::RE2 re0("^\\s*SET\\s+", *parse1v2_opt2); re2::RE2::Replace(&query, re0, ""); +#ifdef DEBUG VALGRIND_ENABLE_ERROR_REPORTING; +#endif // DEBUG std::string var; std::string value1, value2, value3, value4, value5; re2::StringPiece input(query); @@ -393,8 +403,9 @@ VALGRIND_ENABLE_ERROR_REPORTING; std::map> SetParser::parse2() { - +#ifdef DEBUG proxy_debug(PROXY_DEBUG_MYSQL_QUERY_PROCESSOR, 4, "Parsing query %s\n", query.c_str()); +#endif // DEBUG re2::RE2::Options *opt2=new re2::RE2::Options(RE2::Quiet); opt2->set_case_sensitive(false); opt2->set_longest_match(false); @@ -445,7 +456,9 @@ std::map> SetParser::parse2() { } std::string SetParser::parse_character_set() { +#ifdef DEBUG proxy_debug(PROXY_DEBUG_MYSQL_QUERY_PROCESSOR, 4, "Parsing query %s\n", query.c_str()); +#endif // DEBUG re2::RE2::Options *opt2=new re2::RE2::Options(RE2::Quiet); opt2->set_case_sensitive(false); opt2->set_longest_match(false);