[to #51070036] fix cursor init with not null refcursor obj

This commit is contained in:
obdev
2023-08-02 06:18:30 +00:00
committed by ob-robot
parent 59c8e200bf
commit 21c043052c

View File

@ -2900,9 +2900,15 @@ int ObSPIService::spi_cursor_init(ObPLExecCtx *ctx, int64_t cursor_index)
// we should alloc it in open stmt // we should alloc it in open stmt
if (obj.is_ref_cursor_type()) { if (obj.is_ref_cursor_type()) {
if (!obj.is_null()) { if (!obj.is_null()) {
// what's happened? ObPLCursorInfo *cursor_info = NULL;
ret = OB_ERR_UNEXPECTED; CK (obj.is_pl_extend());
LOG_WARN("ref cursor is not null before init", K(ret)); CK (PL_REF_CURSOR_TYPE == obj.get_meta().get_extend_type());
if (OB_SUCC(ret)
&& obj.get_ext() != 0
&& OB_NOT_NULL(cursor_info = reinterpret_cast<ObPLCursorInfo *>(obj.get_ext()))) {
CK (!cursor_info->isopen());
CK (0 == cursor_info->get_ref_count());
}
} else { } else {
// init as null // init as null
obj.set_extend(static_cast<int64_t>(0), PL_REF_CURSOR_TYPE); obj.set_extend(static_cast<int64_t>(0), PL_REF_CURSOR_TYPE);