fix handling invalid character in identifier

This commit is contained in:
wjhh2008
2023-09-22 03:10:14 +00:00
committed by ob-robot
parent e4e09ecfb6
commit c13243ff23
54 changed files with 229 additions and 146 deletions

View File

@ -452,8 +452,8 @@ int ObPlanCache::get_normalized_pattern_digest(const ObPlanCacheCtx &pc_ctx, uin
if (pc_ctx.mode_ == PC_PS_MODE || pc_ctx.mode_ == PC_PL_MODE || pc_ctx.fp_result_.pc_key_.name_.empty()) {
ObFastParserResult fp_result;
ObSQLMode sql_mode = pc_ctx.sql_ctx_.session_info_->get_sql_mode();
ObCollationType conn_coll = pc_ctx.sql_ctx_.session_info_->get_local_collation_connection();
FPContext fp_ctx(conn_coll);
ObCharsets4Parser charsets4parser = pc_ctx.sql_ctx_.session_info_->get_charsets4parser();
FPContext fp_ctx(charsets4parser);
fp_ctx.enable_batched_multi_stmt_ = pc_ctx.sql_ctx_.handle_batched_multi_stmt();
fp_ctx.sql_mode_ = sql_mode;
if (OB_FAIL(ObSqlParameterization::fast_parser(pc_ctx.allocator_,
@ -688,7 +688,7 @@ int ObPlanCache::construct_fast_parser_result(common::ObIAllocator &allocator,
LOG_WARN("get unexpected null", K(ret));
} else {
ObSQLMode sql_mode = pc_ctx.sql_ctx_.session_info_->get_sql_mode();
ObCollationType conn_coll = pc_ctx.sql_ctx_.session_info_->get_local_collation_connection();
ObCharsets4Parser charsets4parser = pc_ctx.sql_ctx_.session_info_->get_charsets4parser();
// if exact mode is on, not needs to do fast parser
bool enable_exact_mode = pc_ctx.sql_ctx_.session_info_->get_enable_exact_mode();
fp_result.cache_params_ =
@ -701,7 +701,7 @@ int ObPlanCache::construct_fast_parser_result(common::ObIAllocator &allocator,
} else if (enable_exact_mode) {
(void)fp_result.pc_key_.name_.assign_ptr(raw_sql.ptr(), raw_sql.length());
} else {
FPContext fp_ctx(conn_coll);
FPContext fp_ctx(charsets4parser);
fp_ctx.enable_batched_multi_stmt_ = pc_ctx.sql_ctx_.handle_batched_multi_stmt();
fp_ctx.sql_mode_ = sql_mode;
bool can_do_batch_insert = false;
@ -972,8 +972,8 @@ int ObPlanCache::check_can_do_insert_opt(common::ObIAllocator &allocator,
int64_t upd_params_count = 0;
int64_t delta_length = 0;
ObSQLMode sql_mode = pc_ctx.sql_ctx_.session_info_->get_sql_mode();
ObCollationType conn_coll = pc_ctx.sql_ctx_.session_info_->get_local_collation_connection();
FPContext fp_ctx(conn_coll);
ObCharsets4Parser charsets4parser = pc_ctx.sql_ctx_.session_info_->get_charsets4parser();
FPContext fp_ctx(charsets4parser);
fp_ctx.enable_batched_multi_stmt_ = pc_ctx.sql_ctx_.handle_batched_multi_stmt();
fp_ctx.sql_mode_ = sql_mode;
ObFastParserMysql fp(allocator, fp_ctx);