fix mysql comment fast parser param node isn't equal normal parser param node

This commit is contained in:
wangt1xiuyi
2023-05-09 02:43:58 +00:00
committed by ob-robot
parent 9c70a896ab
commit fda1d9f41b
2 changed files with 10 additions and 2 deletions

View File

@ -1481,12 +1481,19 @@ int ObFastParserBase::process_double_quote()
int ObFastParserBase::process_comment_content(bool is_mysql_comment) int ObFastParserBase::process_comment_content(bool is_mysql_comment)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
// if is in /*! xxx */ the token tyep should be normal // if is in /*! xxx */ the token type should be normal
cur_token_type_ = is_mysql_comment ? NORMAL_TOKEN : IGNORE_TOKEN; cur_token_type_ = is_mysql_comment ? NORMAL_TOKEN : IGNORE_TOKEN;
bool is_match = false; bool is_match = false;
char ch = raw_sql_.scan(); char ch = raw_sql_.scan();
while (!raw_sql_.is_search_end()) { while (!raw_sql_.is_search_end()) {
if ('*' == ch && '/' == raw_sql_.peek()) { if (is_mysql_comment && '/' == ch && '*' == raw_sql_.peek()) {
raw_sql_.scan();
if (OB_FAIL(process_comment_content())) {
LOG_WARN("failed to process comment content", K(ret));
} else {
cur_token_type_ = NORMAL_TOKEN;
}
} else if ('*' == ch && '/' == raw_sql_.peek()) {
// scan '\/' // scan '\/'
raw_sql_.scan(); raw_sql_.scan();
is_match = true; is_match = true;

View File

@ -911,6 +911,7 @@ int ObParser::parse_sql(const ObString &stmt,
// if is multi_values_parser opt not need retry // if is multi_values_parser opt not need retry
if (lib::is_mysql_mode() && !parse_result.is_multi_values_parser_) { if (lib::is_mysql_mode() && !parse_result.is_multi_values_parser_) {
parse_result.enable_compatible_comment_ = false; parse_result.enable_compatible_comment_ = false;
parse_result.mysql_compatible_comment_ = false;
if (OB_FAIL(sql_parser.parse(stmt.ptr(), stmt.length(), parse_result))) { if (OB_FAIL(sql_parser.parse(stmt.ptr(), stmt.length(), parse_result))) {
//do nothing. //do nothing.
} }