From c22981a4f17f7f893a19a16c349b076965219b39 Mon Sep 17 00:00:00 2001 From: hy-guo Date: Thu, 1 Aug 2024 15:39:08 +0000 Subject: [PATCH] fix create stmt loss err code --- src/sql/resolver/ob_stmt_resolver.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sql/resolver/ob_stmt_resolver.h b/src/sql/resolver/ob_stmt_resolver.h index 8733306c4a..229e62b872 100644 --- a/src/sql/resolver/ob_stmt_resolver.h +++ b/src/sql/resolver/ob_stmt_resolver.h @@ -120,6 +120,7 @@ public: ret = OB_ERR_UNEXPECTED; SQL_RESV_LOG(WARN, "query ctx is null", K(ret)); } else if (OB_FAIL(params_.stmt_factory_->create_stmt(stmt))) { + stmt = NULL; SQL_RESV_LOG(WARN, "create stmt failed", K(ret)); } else if (OB_ISNULL(stmt)) { ret = common::OB_ERR_UNEXPECTED; @@ -128,10 +129,12 @@ public: stmt_ = stmt; stmt_->set_query_ctx(params_.query_ctx_); //mark prepare stmt - stmt_->get_query_ctx()->set_is_prepare_stmt(params_.is_prepare_protocol_ && params_.is_prepare_stage_); + stmt_->get_query_ctx()->set_is_prepare_stmt(params_.is_prepare_protocol_ && params_.is_prepare_stage_); stmt_->get_query_ctx()->set_timezone_info(get_timezone_info(params_.session_info_)); stmt_->get_query_ctx()->set_sql_stmt_coll_type(get_obj_print_params(params_.session_info_).cs_type_); if (OB_FAIL(stmt_->set_stmt_id())) { + stmt = NULL; + stmt_ = NULL; SQL_RESV_LOG(WARN, "fail to set stmt id", K(ret)); } }