1 #ifndef SET_VAR_INCLUDED
2 #define SET_VAR_INCLUDED
23 #include <my_getopt.h>
34 #include "sql_class.h"
44 int mysql_add_sys_var_chain(
sys_var *chain);
45 int mysql_del_sys_var_chain(
sys_var *chain);
59 enum flag_enum { GLOBAL, SESSION, ONLY_SESSION, SCOPE_MASK=1023,
60 READONLY=1024, ALLOCATED=2048, INVISIBLE=4096 };
61 static const int PARSE_EARLY= 1;
62 static const int PARSE_NORMAL= 2;
68 SESSION_VARIABLE_IN_BINLOG } binlog_status;
71 typedef bool (*on_check_function)(
sys_var *
self, THD *thd,
set_var *var);
72 typedef bool (*on_update_function)(
sys_var *
self, THD *thd, enum_var_type
type);
80 on_check_function on_check;
81 on_update_function on_update;
82 const char *
const deprecation_substitute;
87 int flag_args, ptrdiff_t off,
int getopt_id,
88 enum get_opt_arg_type getopt_arg_type, SHOW_TYPE show_val_type_arg,
90 on_check_function on_check_func, on_update_function on_update_func,
91 const char *substitute,
int parse_flag);
105 bool check(THD *thd,
set_var *var);
107 virtual void update_default(longlong new_def_value)
108 {
option.def_value= new_def_value; }
116 bool update(THD *thd,
set_var *var);
119 int scope()
const {
return flags & SCOPE_MASK; }
121 bool is_readonly()
const {
return flags & READONLY; }
122 bool not_visible()
const {
return flags & INVISIBLE; }
128 bool is_written_to_binlog(enum_var_type
type)
129 {
return type != OPT_GLOBAL && binlog_status == SESSION_VARIABLE_IN_BINLOG; }
130 virtual bool check_update_type(Item_result
type) = 0;
131 bool check_type(enum_var_type
type)
135 case GLOBAL:
return type != OPT_GLOBAL;
136 case SESSION:
return false;
137 case ONLY_SESSION:
return type == OPT_GLOBAL;
141 bool register_option(std::vector<my_option> *array,
int parse_flags)
144 (array->push_back(
option),
false);
146 void do_deprecated_warning(THD *thd);
149 virtual bool do_check(THD *thd,
set_var *var) = 0;
153 virtual void session_save_default(THD *thd,
set_var *var) = 0;
157 virtual void global_save_default(THD *thd,
set_var *var) = 0;
158 virtual bool session_update(THD *thd,
set_var *var) = 0;
159 virtual bool global_update(THD *thd,
set_var *var) = 0;
167 virtual uchar *global_value_ptr(THD *thd,
LEX_STRING *base);
175 {
return ((uchar*)&(thd->variables)) +
offset; }
177 uchar *global_var_ptr()
178 {
return ((uchar*)&global_system_variables) +
offset; }
182 #include "sql_plugin.h"
198 virtual int check(THD *thd)=0;
199 virtual int update(THD *thd)=0;
200 virtual int light_check(THD *thd) {
return check(thd); }
201 virtual void print(THD *thd,
String *str)=0;
229 :
var(var_arg), type(type_arg),
base(*base_name_arg)
235 if (value_arg && value_arg->type() == Item::FIELD_ITEM)
238 if (item->field_name)
241 (uint) strlen(item->field_name),
242 system_charset_info)))
260 #ifdef OPTIMIZER_TRACE
263 extern sys_var *Sys_optimizer_trace_ptr;
264 return var == Sys_optimizer_trace_ptr;
279 int update(THD *thd);
281 void print(THD *thd,
String *str);
292 :user(user_arg), password(password_arg)
295 int update(THD *thd);
296 void print(THD *thd,
String *str);
309 enum set_cs_flags_enum { SET_CS_NAMES=1, SET_CS_DEFAULT=2, SET_CS_COLLATE=4 };
314 :set_cs_flags(set_cs_flags_arg),
315 character_set_client(client_coll_arg),
316 character_set_results(result_coll_arg),
317 collation_connection(connection_coll_arg)
320 int update(THD *thd);
321 void print(THD *thd,
String *str);
326 extern SHOW_COMP_OPTION have_csv;
327 extern SHOW_COMP_OPTION have_ndbcluster, have_partitioning;
328 extern SHOW_COMP_OPTION have_profiling;
330 extern SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen;
331 extern SHOW_COMP_OPTION have_query_cache;
332 extern SHOW_COMP_OPTION have_geometry, have_rtree_keys;
333 extern SHOW_COMP_OPTION have_crypt;
334 extern SHOW_COMP_OPTION have_compress;
340 SHOW_VAR* enumerate_sys_vars(THD *thd,
bool sorted,
enum enum_var_type type);
342 sys_var *find_sys_var(THD *thd,
const char *str, uint length=0);
347 sql_mode_t expand_sql_mode(sql_mode_t sql_mode);
348 bool sql_mode_string_representation(THD *thd, sql_mode_t sql_mode,
LEX_STRING *ls);
350 extern sys_var *Sys_autocommit_ptr;
351 extern sys_var *Sys_gtid_next_ptr;
352 extern sys_var *Sys_gtid_next_list_ptr;
353 extern sys_var *Sys_gtid_purged_ptr;
355 const CHARSET_INFO *get_old_charset_by_name(
const char *old_name);
358 int sys_var_add_options(std::vector<my_option> *long_options,
int parse_flags);
359 void sys_var_end(
void);