From 3750fc405d10cc1faf947c808315b16e4107b796 Mon Sep 17 00:00:00 2001 From: obdev Date: Wed, 26 Oct 2022 14:54:15 +0800 Subject: [PATCH] [to #45700625] open_cursor deep copy --- src/observer/virtual_table/ob_virtual_open_cursor_table.cpp | 4 ++-- src/sql/ob_result_set.cpp | 4 +++- src/sql/ob_sql.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/observer/virtual_table/ob_virtual_open_cursor_table.cpp b/src/observer/virtual_table/ob_virtual_open_cursor_table.cpp index be645c03b..99e0e9f44 100644 --- a/src/observer/virtual_table/ob_virtual_open_cursor_table.cpp +++ b/src/observer/virtual_table/ob_virtual_open_cursor_table.cpp @@ -169,6 +169,7 @@ int ObVirtualOpenCursorTable::FillScanner::fill_session_cursor_cell(ObSQLSession const int64_t col_count = output_column_ids_.count(); ObCharsetType default_charset = ObCharset::get_default_charset(); ObCollationType default_collation = ObCharset::get_default_collation(default_charset); + char sql_id[common::OB_MAX_SQL_ID_LENGTH + 1]; for (int64_t i = 0; OB_SUCC(ret) && i < col_count; ++i) { const uint64_t col_id = output_column_ids_.at(i); switch (col_id) { @@ -220,7 +221,6 @@ int ObVirtualOpenCursorTable::FillScanner::fill_session_cursor_cell(ObSQLSession break; } case SQL_ID: { - char sql_id[common::OB_MAX_SQL_ID_LENGTH + 1]; if (obmysql::COM_QUERY == sess_info.get_mysql_cmd() || obmysql::COM_STMT_EXECUTE == sess_info.get_mysql_cmd() || obmysql::COM_STMT_PREPARE == sess_info.get_mysql_cmd() || @@ -303,6 +303,7 @@ int ObVirtualOpenCursorTable::FillScanner::fill_cur_plan_cell(ObSQLSessionInfo & const int64_t col_count = output_column_ids_.count(); ObCharsetType default_charset = ObCharset::get_default_charset(); ObCollationType default_collation = ObCharset::get_default_collation(default_charset); + char sql_id[common::OB_MAX_SQL_ID_LENGTH + 1]; for (int64_t i = 0; OB_SUCC(ret) && i < col_count; ++i) { const uint64_t col_id = output_column_ids_.at(i); switch (col_id) { @@ -354,7 +355,6 @@ int ObVirtualOpenCursorTable::FillScanner::fill_cur_plan_cell(ObSQLSessionInfo & break; } case SQL_ID: { - char sql_id[common::OB_MAX_SQL_ID_LENGTH + 1]; if (obmysql::COM_QUERY == sess_info.get_mysql_cmd() || obmysql::COM_STMT_EXECUTE == sess_info.get_mysql_cmd() || obmysql::COM_STMT_PREPARE == sess_info.get_mysql_cmd() || diff --git a/src/sql/ob_result_set.cpp b/src/sql/ob_result_set.cpp index d13f26a8b..d2389a5a1 100644 --- a/src/sql/ob_result_set.cpp +++ b/src/sql/ob_result_set.cpp @@ -902,7 +902,7 @@ int ObResultSet::from_plan(const ObPhysicalPlan &phy_plan, const ObIArrayset_is_affect_found_row(phy_plan.is_affect_found_row()); - if (plan_ctx->is_ps_protocol() && ps_param_count != phy_plan.get_param_fields().count()) { + if (is_ps_protocol() && ps_param_count != phy_plan.get_param_fields().count()) { if (OB_FAIL(reserve_param_columns(ps_param_count))) { LOG_WARN("reserve param columns failed", K(ret), K(ps_param_count)); } @@ -912,6 +912,8 @@ int ObResultSet::from_plan(const ObPhysicalPlan &phy_plan, const ObIArrayget_orig_question_mark_cnt()), + K(phy_plan.get_returning_param_fields().count()), K(phy_plan.get_param_fields().count())); } else { p_param_columns_ = &phy_plan.get_param_fields(); } diff --git a/src/sql/ob_sql.cpp b/src/sql/ob_sql.cpp index f5bad0f57..ce471e926 100644 --- a/src/sql/ob_sql.cpp +++ b/src/sql/ob_sql.cpp @@ -1502,6 +1502,7 @@ int ObSql::handle_ps_execute(const ObPsStmtId client_stmt_id, ObPsStmtInfoGuard guard; ObPsStmtInfo *ps_info = NULL; pctx->set_original_param_cnt(origin_params_count); + pctx->set_orig_question_mark_cnt(origin_params_count); if (OB_FAIL(ps_cache->get_stmt_info_guard(inner_stmt_id, guard))) { LOG_WARN("get stmt info guard failed", K(ret), K(inner_stmt_id)); } else if (OB_ISNULL(ps_info = guard.get_stmt_info())) { @@ -1539,7 +1540,6 @@ int ObSql::handle_ps_execute(const ObPsStmtId client_stmt_id, #endif if (!ps_info->get_fixed_raw_params().empty()) { pctx->set_is_ps_rewrite_sql(); - pctx->set_orig_question_mark_cnt(origin_params_count); } if (OB_FAIL(session.store_query_string(sql))) { LOG_WARN("store query string fail", K(ret));