[to #48067600] fix cursor null composite parameter
This commit is contained in:
@ -2327,6 +2327,19 @@ int ObPLExecState::set_var(int64_t var_idx, const ObObjParam& value)
|
||||
}
|
||||
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (copy_value.is_null() && params->at(var_idx).is_pl_extend()) {
|
||||
if (params->at(var_idx).get_ext() == 0) {
|
||||
const ObUserDefinedType *user_type = NULL;
|
||||
uint64_t udt_id = params->at(var_idx).get_udt_id();
|
||||
OZ (ctx_.get_user_type(udt_id, user_type), K(udt_id));
|
||||
CK (OB_NOT_NULL(user_type));
|
||||
OZ (init_complex_obj(*get_allocator(), *user_type, params->at(var_idx)));
|
||||
if (OB_SUCC(ret) && user_type->is_collection_type()) {
|
||||
ObPLCollection *coll = reinterpret_cast<ObPLCollection *>(params->at(var_idx).get_ext());
|
||||
CK (OB_NOT_NULL(coll));
|
||||
OX (coll->set_count(OB_INVALID_COUNT));
|
||||
}
|
||||
}
|
||||
} else if (!copy_value.is_ext()) {
|
||||
bool is_ref_cursor = params->at(var_idx).is_ref_cursor_type();
|
||||
copy_value.ObObj::set_scale(params->at(var_idx).get_meta().get_scale());
|
||||
|
||||
@ -196,14 +196,12 @@ int ObPLPackage::instantiate_package_state(const ObPLResolveCtx &resolve_ctx,
|
||||
if (var_type.is_cursor_type()
|
||||
&& OB_FAIL(resolve_ctx.session_info_.init_cursor_cache())) {
|
||||
LOG_WARN("failed to init cursor cache", K(ret));
|
||||
} else if (var->is_formal_param()) {
|
||||
// cursor formal param will as variable added to symbol, skip cursor formal param init
|
||||
} else if (OB_FAIL(var_type.init_session_var(resolve_ctx,
|
||||
var_type.is_cursor_type() ?
|
||||
package_state.get_pkg_cursor_allocator()
|
||||
: package_state.get_pkg_allocator(),
|
||||
exec_ctx,
|
||||
get_default_expr(var->get_default()),
|
||||
var->is_formal_param() ? NULL : get_default_expr(var->get_default()),
|
||||
var->is_default_construct(),
|
||||
value))) {
|
||||
LOG_WARN("init sesssion var failed", K(ret));
|
||||
|
||||
@ -206,6 +206,12 @@ int ObPLPackageState::set_package_var_val(const int64_t var_idx, const ObObj &va
|
||||
ObObj copy;
|
||||
OZ (ObUserDefinedType::deep_copy_obj(inner_allocator_, value, copy));
|
||||
OX (vars_.at(var_idx) = copy);
|
||||
} else if (value.is_null()
|
||||
&& vars_.at(var_idx).is_pl_extend()
|
||||
&& types_.at(var_idx) != PL_CURSOR_TYPE
|
||||
&& types_.at(var_idx) != PL_REF_CURSOR_TYPE) {
|
||||
CK (vars_.at(var_idx).get_ext() != 0);
|
||||
OZ (ObUserDefinedType::destruct_obj(vars_.at(var_idx)));
|
||||
} else {
|
||||
vars_.at(var_idx) = value;
|
||||
}
|
||||
|
||||
@ -330,7 +330,7 @@ int ObUserDefinedType::destruct_obj(ObObj &src, ObSQLSessionInfo *session)
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < record->get_count(); ++i) {
|
||||
OZ (destruct_obj(record->get_element()[i], session));
|
||||
}
|
||||
OX (src.set_null());
|
||||
OX (record->set_null());
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
|
||||
Reference in New Issue
Block a user