From c5da81b2d28596bdd5e63fa7a9aa953e9f589581 Mon Sep 17 00:00:00 2001 From: liuzifeng Date: Tue, 10 Dec 2024 15:10:02 +0800 Subject: [PATCH] fix set --- storage/ctc/ctc_ddl_rewriter_plugin.cc | 6 +++--- storage/ctc/ctc_srv.h | 4 +--- storage/ctc/ha_ctc_ddl.h | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/storage/ctc/ctc_ddl_rewriter_plugin.cc b/storage/ctc/ctc_ddl_rewriter_plugin.cc index f15dfca..7f99c18 100644 --- a/storage/ctc/ctc_ddl_rewriter_plugin.cc +++ b/storage/ctc/ctc_ddl_rewriter_plugin.cc @@ -463,7 +463,7 @@ static int ctc_set_var_meta(MYSQL_THD thd, list variables_info, ct for (auto it = variables_info.begin(); it != variables_info.end(); ++it) { auto var_info = *it; strncpy(set_opt_info_begin->var_name, var_info.var_name, SMALL_RECORD_SIZE - 1); - strncpy(set_opt_info_begin->var_value, var_info.var_value, CTC_MAX_VAR_VALUE_LEN - 1); + strncpy(set_opt_info_begin->var_value, var_info.var_value, MAX_DDL_SQL_LEN - 1); set_opt_info_begin->options |= CTC_NOT_NEED_CANTIAN_EXECUTE; set_opt_info_begin->options |= (thd->lex->contains_plaintext_password ? CTC_CURRENT_SQL_CONTAIN_PLAINTEXT_PASSWORD : 0); @@ -581,7 +581,7 @@ static void ctc_set_var_info(set_var_info *var_info, const char *base_name, stri strncpy(var_info->base_name, base_name, SMALL_RECORD_SIZE - 1); } strncpy(var_info->var_name, name.c_str(), SMALL_RECORD_SIZE - 1); - strncpy(var_info->var_value, value.c_str(), CTC_MAX_VAR_VALUE_LEN - 1); + strncpy(var_info->var_value, value.c_str(), MAX_DDL_SQL_LEN - 1); var_info->options = options; var_info->var_is_int = var_is_int; } @@ -662,7 +662,7 @@ static int check_system_var(set_var_base *var, string &sql_str, MYSQL_THD thd, ret |= ctc_check_set_opt_rule(setvar, name_str, val_str, need_forward); } } - if (strlen(val_str.c_str()) > CTC_MAX_VAR_VALUE_LEN) { + if (strlen(val_str.c_str()) > MAX_DDL_SQL_LEN) { my_printf_error(ER_DISALLOWED_OPERATION, "Set the variable '%s' failed: value is too long", MYF(0), name_str.c_str()); return -1; diff --git a/storage/ctc/ctc_srv.h b/storage/ctc/ctc_srv.h index fa374a7..3e4f75a 100644 --- a/storage/ctc/ctc_srv.h +++ b/storage/ctc/ctc_srv.h @@ -73,8 +73,6 @@ extern "C" { #define CTC_AUTOINC_NEW_STYLE_LOCKING 1 #define CTC_AUTOINC_NO_LOCKING 2 -#define CTC_MAX_VAR_VALUE_LEN 1024 - typedef int64_t date_t; typedef struct { @@ -208,7 +206,7 @@ typedef struct { typedef struct { char base_name[SMALL_RECORD_SIZE]; char var_name[SMALL_RECORD_SIZE]; - char var_value[CTC_MAX_VAR_VALUE_LEN]; + char var_value[MAX_DDL_SQL_LEN]; uint32_t options; bool var_is_int; } set_opt_info_t; diff --git a/storage/ctc/ha_ctc_ddl.h b/storage/ctc/ha_ctc_ddl.h index 1522bf9..1941a74 100644 --- a/storage/ctc/ha_ctc_ddl.h +++ b/storage/ctc/ha_ctc_ddl.h @@ -173,7 +173,7 @@ static map mysql_collate_num_to_ctc_type = { typedef struct { char base_name[SMALL_RECORD_SIZE]; char var_name[SMALL_RECORD_SIZE]; - char var_value[CTC_MAX_VAR_VALUE_LEN]; + char var_value[MAX_DDL_SQL_LEN]; uint32_t options; bool var_is_int; } set_var_info; -- Gitee