fix create outline with error -4016

This commit is contained in:
yishenglanlingzui
2024-03-26 13:45:28 +00:00
committed by ob-robot
parent dcedfcf34b
commit a12d26b9d6
2 changed files with 17 additions and 7 deletions

View File

@ -105,7 +105,7 @@ ObFastParserBase::ObFastParserBase(
tmp_buf_(nullptr), tmp_buf_len_(0), last_escape_check_pos_(0), tmp_buf_(nullptr), tmp_buf_len_(0), last_escape_check_pos_(0),
param_node_list_(nullptr), tail_param_node_(nullptr), param_node_list_(nullptr), tail_param_node_(nullptr),
cur_token_type_(INVALID_TOKEN), allocator_(allocator), cur_token_type_(INVALID_TOKEN), allocator_(allocator),
get_insert_(false), values_token_pos_(0), found_insert_status_(NOT_FOUND_INSERT_TOKEN), values_token_pos_(0),
parse_next_token_func_(nullptr), process_idf_func_(nullptr) parse_next_token_func_(nullptr), process_idf_func_(nullptr)
{ {
question_mark_ctx_.count_ = 0; question_mark_ctx_.count_ = 0;
@ -154,8 +154,10 @@ int ObFastParserBase::parse(const ObString &stmt,
no_param_sql_len = no_param_sql_len_; no_param_sql_len = no_param_sql_len_;
param_list = param_node_list_; param_list = param_node_list_;
param_num = param_num_; param_num = param_num_;
if (found_insert_status_ == FOUND_INSERT_TOKEN_ONCE) {
values_token_pos = values_token_pos_; values_token_pos = values_token_pos_;
} }
}
return ret; return ret;
} }
@ -772,9 +774,11 @@ int ObFastParserBase::process_insert_or_replace(const char *str, const int64_t s
raw_sql_.scan(size); raw_sql_.scan(size);
if (OB_FAIL(process_hint())) { if (OB_FAIL(process_hint())) {
LOG_WARN("failed to process hint", K(ret), K(raw_sql_.to_string()), K_(raw_sql_.cur_pos)); LOG_WARN("failed to process hint", K(ret), K(raw_sql_.to_string()), K_(raw_sql_.cur_pos));
} else { } else if (found_insert_status_ == NOT_FOUND_INSERT_TOKEN) {
// 说明是insert token // 说明是insert token
get_insert_ = true; found_insert_status_ = FOUND_INSERT_TOKEN_ONCE;
} else if (found_insert_status_ == FOUND_INSERT_TOKEN_ONCE) {
found_insert_status_ = INVALID_TOKEN_STATUS;
} }
} }
return ret; return ret;
@ -2517,7 +2521,7 @@ int ObFastParserMysql::process_identifier_begin_with_n()
int ObFastParserMysql::process_values(const char *str) int ObFastParserMysql::process_values(const char *str)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
if (get_insert_) { if (found_insert_status_ == FOUND_INSERT_TOKEN_ONCE) {
if (!is_oracle_mode_) { if (!is_oracle_mode_) {
// mysql support: insert ... values / value (xx, ...); // mysql support: insert ... values / value (xx, ...);
if (CHECK_EQ_STRNCASECMP("alues", 5)) { if (CHECK_EQ_STRNCASECMP("alues", 5)) {
@ -2977,7 +2981,7 @@ int ObFastParserOracle::process_identifier_begin_with_n()
int ObFastParserOracle::process_values(const char *str) int ObFastParserOracle::process_values(const char *str)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
if (get_insert_) { if (found_insert_status_ == FOUND_INSERT_TOKEN_ONCE) {
if (is_oracle_mode_) { if (is_oracle_mode_) {
if (CHECK_EQ_STRNCASECMP("alues", 5)) { if (CHECK_EQ_STRNCASECMP("alues", 5)) {
values_token_pos_ = raw_sql_.cur_pos_; values_token_pos_ = raw_sql_.cur_pos_;

View File

@ -618,6 +618,12 @@ protected:
bool skip_space(ObRawSql &raw_sql); bool skip_space(ObRawSql &raw_sql);
protected: protected:
enum FoundInsertTokenStatus
{
NOT_FOUND_INSERT_TOKEN,
FOUND_INSERT_TOKEN_ONCE, // find one insert token
INVALID_TOKEN_STATUS, // find insert token more than one time
};
ObRawSql raw_sql_; ObRawSql raw_sql_;
char *no_param_sql_; char *no_param_sql_;
int64_t no_param_sql_len_; int64_t no_param_sql_len_;
@ -639,7 +645,7 @@ protected:
common::ObIAllocator &allocator_; common::ObIAllocator &allocator_;
common::ObCharsetType charset_type_; common::ObCharsetType charset_type_;
const ObCharsetInfo *charset_info_; const ObCharsetInfo *charset_info_;
bool get_insert_; FoundInsertTokenStatus found_insert_status_;
int64_t values_token_pos_; int64_t values_token_pos_;
ParseNextTokenFunc parse_next_token_func_; ParseNextTokenFunc parse_next_token_func_;
ProcessIdfFunc process_idf_func_; ProcessIdfFunc process_idf_func_;