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

@ -13,6 +13,7 @@
#define USING_LOG_PREFIX SQL_ENG
#include <string.h>
#include "lib/utility/ob_print_utils.h"
#include "share/object/ob_obj_cast.h"
#include "objit/common/ob_item_type.h"
#include "sql/engine/expr/ob_expr_func_dump.h"
@ -229,7 +230,7 @@ int ObExprFuncDump::calc_number(const common::ObObj &input,
input.get_type(), nmb.get_deep_copy_size()))) {
LOG_WARN("failed to databuff_printf", K(ret), K(nmb));
} else if (ReturnFormat::RF_OB_SEPC == fmt_enum) {
if (OB_FAIL(databuff_print_obj(tmp_buf, buff_size, pos, nmb))) {
if (OB_FAIL(common::databuff_print_obj(tmp_buf, buff_size, pos, nmb))) {
LOG_WARN("failed to databuff_printf", K(ret), K(pos));
}
} else {
@ -461,7 +462,7 @@ static int dump_ob_spec(char *buf, int64_t buf_len, int64_t &buf_pos, bool &dump
case ObNumberType:
case ObNumberFloatType: {
number::ObNumber nmb(datum.get_number());
OZ(databuff_print_obj(buf, buf_len, buf_pos, nmb));
OZ(common::databuff_print_obj(buf, buf_len, buf_pos, nmb));
break;
}
case ObDateTimeType: {

View File

@ -50,7 +50,9 @@ int calc_digest_text(ObIAllocator &allocator,
sql_ctx.schema_guard_ = schema_guard;
ObPlanCacheCtx pc_ctx(sql_str, PC_TEXT_MODE, allocator, sql_ctx, exec_ctx,
session->get_effective_tenant_id());
ObParser parser(allocator, session->get_sql_mode(), cs_type);
ObCharsets4Parser charsets4parser = session->get_charsets4parser();
charsets4parser.string_collation_ = cs_type;
ObParser parser(allocator, session->get_sql_mode(), charsets4parser);
ObSEArray<ObString, 1> queries;
ObMPParseStat parse_stat;
if (OB_FAIL(parser.split_multiple_stmt(sql_str, queries, parse_stat))) {
@ -90,7 +92,7 @@ int calc_digest_text(ObIAllocator &allocator,
pc_ctx,
parse_result.result_tree_,
tmp_params,
cs_type))) {
charsets4parser))) {
LOG_WARN("fail to parameterize syntax tree", K(sql_str), K(ret));
} else {
digest_str = pc_ctx.sql_ctx_.spm_ctx_.bl_key_.constructed_sql_;