fix parameterize dml sql bug in statement_digest
This commit is contained in:
@ -19,6 +19,7 @@
|
|||||||
#include "sql/session/ob_sql_session_info.h"
|
#include "sql/session/ob_sql_session_info.h"
|
||||||
#include "sql/engine/expr/ob_datum_cast.h"
|
#include "sql/engine/expr/ob_datum_cast.h"
|
||||||
#include "share/ob_encryption_util.h"
|
#include "share/ob_encryption_util.h"
|
||||||
|
#include "sql/resolver/ob_resolver_utils.h"
|
||||||
|
|
||||||
using namespace oceanbase::common;
|
using namespace oceanbase::common;
|
||||||
using namespace oceanbase::share;
|
using namespace oceanbase::share;
|
||||||
@ -49,9 +50,13 @@ int calc_digest_text(ObIAllocator &allocator,
|
|||||||
ObParser parser(allocator, session->get_sql_mode(), cs_type);
|
ObParser parser(allocator, session->get_sql_mode(), cs_type);
|
||||||
ParseResult parse_result;
|
ParseResult parse_result;
|
||||||
ParamStore tmp_params((ObWrapperAllocator(allocator)));
|
ParamStore tmp_params((ObWrapperAllocator(allocator)));
|
||||||
|
stmt::StmtType stmt_type = stmt::T_NONE;
|
||||||
if (OB_FAIL(parser.parse(sql_str, parse_result))) {
|
if (OB_FAIL(parser.parse(sql_str, parse_result))) {
|
||||||
LOG_WARN("fail to parse sql str", K(sql_str), K(ret));
|
LOG_WARN("fail to parse sql str", K(sql_str), K(ret));
|
||||||
} else if (OB_FAIL(ObSqlParameterization::parameterize_syntax_tree(allocator,
|
} else if (OB_FAIL(ObResolverUtils::resolve_stmt_type(parse_result, stmt_type))) {
|
||||||
|
LOG_WARN("failed to resolve stmt type", K(ret));
|
||||||
|
} else if (ObStmt::is_dml_stmt(stmt_type) && !ObStmt::is_show_stmt(stmt_type)) {
|
||||||
|
if (OB_FAIL(ObSqlParameterization::parameterize_syntax_tree(allocator,
|
||||||
true,
|
true,
|
||||||
pc_ctx,
|
pc_ctx,
|
||||||
parse_result.result_tree_,
|
parse_result.result_tree_,
|
||||||
@ -61,6 +66,9 @@ int calc_digest_text(ObIAllocator &allocator,
|
|||||||
} else {
|
} else {
|
||||||
digest_str = pc_ctx.sql_ctx_.spm_ctx_.bl_key_.constructed_sql_;
|
digest_str = pc_ctx.sql_ctx_.spm_ctx_.bl_key_.constructed_sql_;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
digest_str = sql_str;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user