提交 a6f1d1d1 编写于 作者: O obdev 提交者: LINGuanRen

[CP] Fix core at resolve paramed const

上级 4891d24b
......@@ -1336,7 +1336,13 @@ int ObSqlParameterization::resolve_paramed_const(SelectItemTraverseCtx& ctx)
} else {
const ParseNode* param_node = ctx.raw_params_.at(idx)->node_;
int64_t tmp_len = std::min(ctx.buf_len_ - ctx.param_info_.name_len_, param_node->raw_sql_offset_ - ctx.expr_pos_);
if (tmp_len > 0) {
// In the case of select _binary 'abc';, special processing is required, because the value of
// org_expr_name_ is the same as that of raw param in this scenario.
// So it is judged here that if org_expr_name_ is the same as param_node->str_value_ value
// there is no need to copy it. paramed_field_name_ should be replaced with '?'
if (0 == ctx.org_expr_name_.case_compare(ObString(param_node->str_len_, param_node->str_value_))) {
// do nothing
} else if (tmp_len > 0) {
int32_t len = static_cast<int64_t>(tmp_len);
MEMCPY(ctx.param_info_.paramed_field_name_ + ctx.param_info_.name_len_,
ctx.org_expr_name_.ptr() + ctx.expr_pos_ - ctx.expr_start_pos_,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册