[to #46737517] fix null complex argument core

This commit is contained in:
obdev 2022-12-20 07:41:37 +00:00 committed by ob-robot
parent 8ffb94cd93
commit 47adcea9b8
2 changed files with 23 additions and 19 deletions

View File

@ -2136,7 +2136,7 @@ int ObPLExecState::init_complex_obj(ObIAllocator &allocator,
CK (OB_NOT_NULL(schema_guard = ctx_.exec_ctx_->get_sql_ctx()->schema_guard_));
CK (OB_NOT_NULL(sql_proxy = ctx_.exec_ctx_->get_sql_proxy()));
CK (OB_NOT_NULL(package_guard = ctx_.exec_ctx_->get_package_guard()));
if (pl_type.is_ref_cursor_type()) {
if (pl_type.is_ref_cursor_type() || pl_type.is_sys_refcursor_type()) {
OX (obj.set_is_ref_cursor_type(true));
} else if (pl_type.is_udt_type()) {
ObPLUDTNS ns(*schema_guard);
@ -2149,19 +2149,11 @@ int ObPLExecState::init_complex_obj(ObIAllocator &allocator,
*sql_proxy,
false);
OZ (ns.init_complex_obj(allocator, pl_type, obj, false));
} else if (pl_type.is_sys_refcursor_type()) {
OX (obj.set_is_ref_cursor_type(true));
// ObPLCursorInfo *cursor = NULL;
// if (obj.is_null()) {
// OZ (session->make_cursor(cursor));
// OX (obj.set_ext(reinterpret_cast<int64_t>(cursor)));
// OX (obj.set_param_meta());
// } else {
// cursor = reinterpret_cast<ObPLCursorInfo*>(obj.get_ext());
// int64_t id = cursor->get_id(); //已经分配好的SYS REFCURSOR,关闭语句后id需要保留
// OZ (cursor->close(*session));
// OX (cursor->set_id(id));
// }
} else if (OB_NOT_NULL(session->get_pl_context())
&& OB_NOT_NULL(session->get_pl_context()->get_current_ctx())) {
pl::ObPLINS *ns = session->get_pl_context()->get_current_ctx();
CK (OB_NOT_NULL(ns));
OZ (ns->init_complex_obj(allocator, pl_type, obj, false));
}
OX (obj.set_udt_id(pl_type.get_user_type_id()));
return ret;
@ -2414,7 +2406,9 @@ do { \
OZ (init_complex_obj(
(*get_allocator()), func_.get_variables().at(i), get_params().at(i)));
}
} else if (pl_type.is_composite_type() && params->at(i).is_null()) {
} else if (pl_type.is_composite_type()
&& (params->at(i).is_null()
|| (params->at(i).is_ext() && params->at(i).get_ext() == 0))) {
// 如果复杂类型传入了null则构造一个初始化的值
OZ (init_complex_obj((*get_allocator()),
func_.get_variables().at(i),

View File

@ -4199,7 +4199,7 @@ int ObPLCodeGenerator::generate_get_collection_attr(ObLLVMValue &param_array,
element_idx,
current_value));
if (OB_SUCC(ret) && !for_write) {
if (OB_SUCC(ret)) {
// check deleted value
ObLLVMValue p_type_value;
ObLLVMValue type_value;
@ -4211,9 +4211,19 @@ int ObPLCodeGenerator::generate_get_collection_attr(ObLLVMValue &param_array,
OZ (helper_.create_icmp_eq(type_value, ObMaxType, is_deleted));
OZ (helper_.create_cond_br(is_deleted, delete_block, after_delete_block));
OZ (helper_.set_insert_point(delete_block));
OZ (helper_.get_int32(OB_READ_NOTHING, ret_value));
OZ (helper_.create_store(ret_value, ret_value_ptr));
OZ (helper_.create_br(exit));
if (!for_write) {
OZ (helper_.get_int32(OB_READ_NOTHING, ret_value));
OZ (helper_.create_store(ret_value, ret_value_ptr));
OZ (helper_.create_br(exit));
} else {
if (current_access.var_type_.is_composite_type()) {
OZ (helper_.get_int8(ObExtendType, type_value));
} else {
OZ (helper_.get_int8(current_access.var_type_.get_obj_type(), type_value));
}
OZ (helper_.create_store(type_value, p_type_value));
OZ (helper_.create_br(after_delete_block));
}
OZ (helper_.set_insert_point(after_delete_block));
}
} else {