[CP] [#2024101600104721501]Fix to catch error code in fast parse

This commit is contained in:
bit-dance 2024-11-08 07:45:14 +00:00 committed by ob-robot
parent dc351135ce
commit 4bc9424081

View File

@ -86,24 +86,27 @@ int ObPLParser::fast_parse(const ObString &query,
parse_ctx.no_param_sql_buf_len_ = new_length;
}
if (OB_SUCC(ret)) {
ret = parse_stmt_block(parse_ctx, parse_result.result_tree_);
if (OB_ERR_PARSE_SQL == ret) {
int err_len = 0;
const char *err_str = "", *global_errmsg = "";
int err_line = 0;
if (parse_ctx.cur_error_info_ != NULL) {
int first_column = parse_ctx.cur_error_info_->stmt_loc_.first_column_;
int last_column = parse_ctx.cur_error_info_->stmt_loc_.last_column_;
err_len = last_column - first_column + 1;
err_str = parse_ctx.stmt_str_ + first_column;
err_line = parse_ctx.cur_error_info_->stmt_loc_.last_line_ + 1;
global_errmsg = parse_ctx.global_errmsg_;
if (OB_FAIL(parse_stmt_block(parse_ctx, parse_result.result_tree_))) {
if (OB_ERR_PARSE_SQL == ret) {
int err_len = 0;
const char *err_str = "", *global_errmsg = "";
int err_line = 0;
if (parse_ctx.cur_error_info_ != NULL) {
int first_column = parse_ctx.cur_error_info_->stmt_loc_.first_column_;
int last_column = parse_ctx.cur_error_info_->stmt_loc_.last_column_;
err_len = last_column - first_column + 1;
err_str = parse_ctx.stmt_str_ + first_column;
err_line = parse_ctx.cur_error_info_->stmt_loc_.last_line_ + 1;
global_errmsg = parse_ctx.global_errmsg_;
}
ObString stmt(parse_ctx.stmt_len_, parse_ctx.stmt_str_);
LOG_WARN("failed to parse pl stmt",
K(ret), K(err_line), K(global_errmsg), K(stmt));
LOG_USER_ERROR(OB_ERR_PARSE_SQL, ob_errpkt_strerror(OB_ERR_PARSER_SYNTAX, false),
err_len, err_str, err_line);
} else {
LOG_WARN("failed to parse pl stmt", K(ret));
}
ObString stmt(parse_ctx.stmt_len_, parse_ctx.stmt_str_);
LOG_WARN("failed to parser pl stmt",
K(ret), K(err_line), K(global_errmsg), K(stmt));
LOG_USER_ERROR(OB_ERR_PARSE_SQL, ob_errpkt_strerror(OB_ERR_PARSER_SYNTAX, false),
err_len, err_str, err_line);
} else {
memmove(parse_ctx.no_param_sql_ + parse_ctx.no_param_sql_len_,
parse_ctx.stmt_str_ + parse_ctx.copied_pos_,