diff options
Diffstat (limited to 'sql/set_var.h')
-rw-r--r-- | sql/set_var.h | 104 |
1 files changed, 79 insertions, 25 deletions
diff --git a/sql/set_var.h b/sql/set_var.h index 1ae3a18111f..c029f83788f 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -46,14 +46,10 @@ public: const char *name; sys_after_update_func after_update; -#if MYSQL_VERSION_ID < 50000 bool no_support_one_shot; -#endif sys_var(const char *name_arg, sys_after_update_func func= NULL) :name(name_arg), after_update(func) -#if MYSQL_VERSION_ID < 50000 , no_support_one_shot(1) -#endif {} virtual ~sys_var() {} virtual bool check(THD *thd, set_var *var); @@ -72,6 +68,7 @@ public: { return option_limits == 0; } Item *item(THD *thd, enum_var_type type, LEX_STRING *base); virtual bool is_struct() { return 0; } + virtual bool is_readonly() const { return 0; } }; @@ -223,6 +220,36 @@ public: return 1; } bool check_default(enum_var_type type) { return 1; } + bool is_readonly() const { return 1; } +}; + + +class sys_var_const_str_ptr :public sys_var +{ +public: + char **value; // Pointer to const value + sys_var_const_str_ptr(const char *name_arg, char **value_arg) + :sys_var(name_arg),value(value_arg) + {} + bool check(THD *thd, set_var *var) + { + return 1; + } + bool update(THD *thd, set_var *var) + { + return 1; + } + SHOW_TYPE type() { return SHOW_CHAR; } + byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) + { + return (byte*) *value; + } + bool check_update_type(Item_result type) + { + return 1; + } + bool check_default(enum_var_type type) { return 1; } + bool is_readonly() const { return 1; } }; @@ -391,6 +418,8 @@ public: } void set_default(THD *thd, enum_var_type type); byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + static byte *symbolic_mode_representation(THD *thd, ulong sql_mode, + ulong *length); }; @@ -528,9 +557,7 @@ class sys_var_collation :public sys_var_thd public: sys_var_collation(const char *name_arg) :sys_var_thd(name_arg) { -#if MYSQL_VERSION_ID < 50000 no_support_one_shot= 0; -#endif } bool check(THD *thd, set_var *var); SHOW_TYPE type() { return SHOW_CHAR; } @@ -550,13 +577,11 @@ public: sys_var_thd(name_arg) { nullable= 0; -#if MYSQL_VERSION_ID < 50000 /* In fact only almost all variables derived from sys_var_character_set support ONE_SHOT; character_set_results doesn't. But that's good enough. */ no_support_one_shot= 0; -#endif } bool check(THD *thd, set_var *var); SHOW_TYPE type() { return SHOW_CHAR; } @@ -571,6 +596,15 @@ public: virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0; }; +class sys_var_character_set_filesystem :public sys_var_character_set +{ +public: + sys_var_character_set_filesystem(const char *name_arg) : + sys_var_character_set(name_arg) {} + void set_default(THD *thd, enum_var_type type); + CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type); +}; + class sys_var_character_set_client :public sys_var_character_set { public: @@ -595,9 +629,6 @@ class sys_var_character_set_server :public sys_var_character_set public: sys_var_character_set_server(const char *name_arg) : sys_var_character_set(name_arg) {} -#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50000) - bool check(THD *thd, set_var *var); -#endif void set_default(THD *thd, enum_var_type type); CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type); }; @@ -633,9 +664,6 @@ class sys_var_collation_server :public sys_var_collation { public: sys_var_collation_server(const char *name_arg) :sys_var_collation(name_arg) {} -#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50000) - bool check(THD *thd, set_var *var); -#endif bool update(THD *thd, set_var *var); void set_default(THD *thd, enum_var_type type); byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); @@ -735,6 +763,7 @@ public: return (*value_ptr_func)(thd); } SHOW_TYPE type() { return show_type; } + bool is_readonly() const { return 1; } }; class sys_var_thd_time_zone :public sys_var_thd @@ -743,9 +772,7 @@ public: sys_var_thd_time_zone(const char *name_arg): sys_var_thd(name_arg) { -#if MYSQL_VERSION_ID < 50000 no_support_one_shot= 0; -#endif } bool check(THD *thd, set_var *var); SHOW_TYPE type() { return SHOW_CHAR; } @@ -759,11 +786,40 @@ public: virtual void set_default(THD *thd, enum_var_type type); }; + +class sys_var_max_user_conn : public sys_var_thd +{ +public: + sys_var_max_user_conn(const char *name_arg): + sys_var_thd(name_arg) {} + bool check(THD *thd, set_var *var); + bool update(THD *thd, set_var *var); + bool check_default(enum_var_type type) + { + return type != OPT_GLOBAL || !option_limits; + } + void set_default(THD *thd, enum_var_type type); + SHOW_TYPE type() { return SHOW_INT; } + byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); +}; + +class sys_var_trust_routine_creators :public sys_var_bool_ptr +{ + /* We need a derived class only to have a warn_deprecated() */ +public: + sys_var_trust_routine_creators(const char *name_arg, my_bool *value_arg) : + sys_var_bool_ptr(name_arg, value_arg) {}; + void warn_deprecated(THD *thd); + void set_default(THD *thd, enum_var_type type); + bool update(THD *thd, set_var *var); +} + + class sys_var_thd_lc_time_names :public sys_var_thd { public: sys_var_thd_lc_time_names(const char *name_arg): - sys_var_thd(name_arg) + sys_var_thd(name_arg) {} bool check(THD *thd, set_var *var); SHOW_TYPE type() { return SHOW_CHAR; } @@ -790,9 +846,7 @@ public: virtual int update(THD *thd)=0; /* To set the value */ /* light check for PS */ virtual int light_check(THD *thd) { return check(thd); } -#if MYSQL_VERSION_ID < 50000 virtual bool no_support_one_shot() { return 1; } -#endif }; @@ -815,7 +869,7 @@ public: } save_result; LEX_STRING base; /* for structs */ - set_var(enum_var_type type_arg, sys_var *var_arg, LEX_STRING *base_name_arg, + set_var(enum_var_type type_arg, sys_var *var_arg, const LEX_STRING *base_name_arg, Item *value_arg) :var(var_arg), type(type_arg), base(*base_name_arg) { @@ -826,7 +880,8 @@ public: if (value_arg && value_arg->type() == Item::FIELD_ITEM) { Item_field *item= (Item_field*) value_arg; - if (!(value=new Item_string(item->field_name, strlen(item->field_name), + if (!(value=new Item_string(item->field_name, + (uint) strlen(item->field_name), item->collation.collation))) value=value_arg; /* Give error message later */ } @@ -836,9 +891,7 @@ public: int check(THD *thd); int update(THD *thd); int light_check(THD *thd); -#if MYSQL_VERSION_ID < 50000 bool no_support_one_shot() { return var->no_support_one_shot; } -#endif }; @@ -904,7 +957,7 @@ public: uint name_length_arg, gptr data_arg) :name_length(name_length_arg), data(data_arg) { - name= my_strdup_with_length((byte*) name_arg, name_length, MYF(MY_WME)); + name= my_strdup_with_length(name_arg, name_length, MYF(MY_WME)); links->push_back(this); } inline bool cmp(const char *name_cmp, uint length) @@ -944,10 +997,11 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list); bool not_all_support_one_shot(List<set_var_base> *var_list); void fix_delay_key_write(THD *thd, enum_var_type type); ulong fix_sql_mode(ulong sql_mode); -extern sys_var_str sys_charset_system; +extern sys_var_const_str sys_charset_system; extern sys_var_str sys_init_connect; extern sys_var_str sys_init_slave; extern sys_var_thd_time_zone sys_time_zone; +extern sys_var_thd_bit sys_autocommit; CHARSET_INFO *get_old_charset_by_name(const char *old_name); gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length, NAMED_LIST **found); |