MySQL  8.0.16
Source Code Documentation
set_var.h
Go to the documentation of this file.
1 #ifndef SET_VAR_INCLUDED
2 #define SET_VAR_INCLUDED
3 /* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License, version 2.0,
7  as published by the Free Software Foundation.
8 
9  This program is also distributed with certain software (including
10  but not limited to OpenSSL) that is licensed under separate terms,
11  as designated in a particular file or component or in included license
12  documentation. The authors of MySQL hereby grant you an additional
13  permission to link the program and your derivative works with the
14  separately licensed software that they have included with MySQL.
15 
16  This program is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License, version 2.0, for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
24 
25 /**
26  @file
27  "public" interface to sys_var - server configuration variables.
28 */
29 
30 #include "my_config.h"
31 
32 #include <stddef.h>
33 #include <string.h>
34 #include <sys/types.h>
35 #include <string>
36 #include <vector>
37 
38 #include "lex_string.h"
39 #include "m_ctype.h"
40 #include "my_getopt.h" // get_opt_arg_type
41 #include "my_inttypes.h"
42 #include "my_sys.h"
43 #include "my_systime.h" // my_micro_time()
45 #include "mysql/status_var.h"
47 #include "mysql_com.h" // Item_result
48 #include "prealloced_array.h" // Prealloced_array
49 #include "sql/sql_const.h" // SHOW_COMP_OPTION
50 #include "sql/sql_plugin_ref.h" // plugin_ref
51 #include "typelib.h" // TYPELIB
52 
53 class Item;
55 class PolyLock;
56 class String;
57 class THD;
58 class Time_zone;
59 class set_var;
60 class sys_var;
61 class sys_var_pluginvar;
62 struct LEX_USER;
63 template <class Key, class Value>
65 
66 typedef ulonglong sql_mode_t;
69 template <class T>
70 class List;
71 
72 extern TYPELIB bool_typelib;
73 
74 /* Number of system variable elements to preallocate. */
75 #define SHOW_VAR_PREALLOC 200
77 
78 struct sys_var_chain {
81 };
82 
85 
86 enum enum_var_type : int {
92 };
93 
94 /**
95  A class representing one system variable - that is something
96  that can be accessed as @@global.variable_name or @@session.variable_name,
97  visible in SHOW xxx VARIABLES and in INFORMATION_SCHEMA.xxx_VARIABLES,
98  optionally it can be assigned to, optionally it can have a command-line
99  counterpart with the same name.
100 */
101 class sys_var {
102  public:
105  enum flag_enum {
106  GLOBAL = 0x0001,
107  SESSION = 0x0002,
108  ONLY_SESSION = 0x0004,
109  SCOPE_MASK = 0x03FF, // 1023
110  READONLY = 0x0400, // 1024
111  ALLOCATED = 0x0800, // 2048
112  INVISIBLE = 0x1000, // 4096
113  TRI_LEVEL = 0x2000, // 8192 - default is neither GLOBAL nor SESSION
114  NOTPERSIST = 0x4000,
115  HINT_UPDATEABLE = 0x8000, // Variable is updateable using SET_VAR hint
116  /**
117  There can be some variables which needs to be set before plugin is loaded.
118  ex: binlog_checksum needs to be set before GR plugin is loaded.
119  Also, there are some variables which needs to be set before some server
120  internal component initialization.
121  ex: binlog_encryption needs to be set before binary and relay log
122  files generation.
123  */
124 
126  };
127  static const int PARSE_EARLY = 1;
128  static const int PARSE_NORMAL = 2;
129  /**
130  Enumeration type to indicate for a system variable whether
131  it will be written to the binlog or not.
132  */
136  } binlog_status;
137 
138  protected:
139  typedef bool (*on_check_function)(sys_var *self, THD *thd, set_var *var);
140  typedef bool (*on_update_function)(sys_var *self, THD *thd,
142 
143  int flags; ///< or'ed flag_enum values
144  int m_parse_flag; ///< either PARSE_EARLY or PARSE_NORMAL.
145  const SHOW_TYPE show_val_type; ///< what value_ptr() returns for sql_show.cc
146  my_option option; ///< min, max, default values are stored here
147  PolyLock *guard; ///< *second* lock that protects the variable
148  ptrdiff_t offset; ///< offset to the value from global_system_variables
151  const char *const deprecation_substitute;
152  bool is_os_charset; ///< true if the value is in character_set_filesystem
154  char user[USERNAME_CHAR_LENGTH]; /* which user has set this variable */
155  char host[HOSTNAME_LENGTH]; /* host on which this variable is set */
156  ulonglong timestamp; /* represents when this variable was set */
157 
158  public:
159  sys_var(sys_var_chain *chain, const char *name_arg, const char *comment,
160  int flag_args, ptrdiff_t off, int getopt_id,
161  enum get_opt_arg_type getopt_arg_type, SHOW_TYPE show_val_type_arg,
162  longlong def_val, PolyLock *lock,
163  enum binlog_status_enum binlog_status_arg,
164  on_check_function on_check_func, on_update_function on_update_func,
165  const char *substitute, int parse_flag);
166 
167  virtual ~sys_var() {}
168 
169  /**
170  All the cleanup procedures should be performed here
171  */
172  virtual void cleanup() {}
173  /**
174  downcast for sys_var_pluginvar. Returns this if it's an instance
175  of sys_var_pluginvar, and 0 otherwise.
176  */
177  virtual sys_var_pluginvar *cast_pluginvar() { return 0; }
178 
179  bool check(THD *thd, set_var *var);
180  uchar *value_ptr(THD *running_thd, THD *target_thd, enum_var_type type,
181  LEX_STRING *base);
183  virtual void update_default(longlong new_def_value) {
184  option.def_value = new_def_value;
185  }
186  longlong get_default() { return option.def_value; }
187  virtual bool is_default(THD *thd, set_var *var);
188  virtual longlong get_min_value() { return option.min_value; }
189  virtual ulonglong get_max_value() { return option.max_value; }
190  /**
191  Returns variable type.
192 
193  @return variable type
194  */
195  virtual ulong get_var_type() { return (option.var_type & GET_TYPE_MASK); }
197  virtual void set_is_plugin(bool) {}
199  const char *get_source_name() { return source.m_path_name; }
201  option.arg_source->m_source = src;
202  }
203  void set_source_name(const char *path) {
204  strcpy(option.arg_source->m_path_name, path);
205  }
206  void set_user(const char *usr) { strcpy(user, usr); }
207  const char *get_user() { return user; }
208  const char *get_host() { return host; }
209  void set_host(const char *hst) { strcpy(host, hst); }
210  ulonglong get_timestamp() const { return timestamp; }
211  void set_user_host(THD *thd);
212  my_option *get_option() { return &option; }
214  void set_timestamp(ulonglong ts) { timestamp = ts; }
216  user[0] = '\0';
217  host[0] = '\0';
218  timestamp = 0;
219  }
220  virtual bool is_non_persistent() { return flags & NOTPERSIST; }
221 
222  /**
223  Update the system variable with the default value from either
224  session or global scope. The default value is stored in the
225  'var' argument. Return false when successful.
226  */
227  bool set_default(THD *thd, set_var *var);
228  bool update(THD *thd, set_var *var);
229 
230  /**
231  This function converts value stored in save_result to string. This
232  function must ba called after calling save_default() as save_default() will
233  store default value to save_result.
234  */
235  virtual void saved_value_to_string(THD *thd, set_var *var, char *def_val) = 0;
236 
238  int scope() const { return flags & SCOPE_MASK; }
239  const CHARSET_INFO *charset(THD *thd);
240  bool is_readonly() const { return flags & READONLY; }
241  bool not_visible() const { return flags & INVISIBLE; }
242  bool is_trilevel() const { return flags & TRI_LEVEL; }
243  bool is_persist_readonly() const { return flags & PERSIST_AS_READ_ONLY; }
244  /**
245  Check if the variable can be set using SET_VAR hint.
246 
247  @return true if the variable can be set using SET_VAR hint,
248  false otherwise.
249  */
250  bool is_hint_updateable() const { return flags & HINT_UPDATEABLE; }
251  /**
252  the following is only true for keycache variables,
253  that support the syntax @@keycache_name.variable_name
254  */
255  bool is_struct() { return option.var_type & GET_ASK_ADDR; }
258  }
259  virtual bool check_update_type(Item_result type) = 0;
260 
261  /**
262  Return true for success if:
263  Global query and variable scope is GLOBAL or SESSION, or
264  Session query and variable scope is SESSION or ONLY_SESSION.
265  */
266  bool check_scope(enum_var_type query_type) {
267  switch (query_type) {
268  case OPT_PERSIST:
269  case OPT_PERSIST_ONLY:
270  case OPT_GLOBAL:
271  return scope() & (GLOBAL | SESSION);
272  case OPT_SESSION:
273  return scope() & (SESSION | ONLY_SESSION);
274  case OPT_DEFAULT:
275  return scope() & (SESSION | ONLY_SESSION);
276  }
277  return false;
278  }
280  return (type == OPT_GLOBAL || type == OPT_PERSIST ||
282  }
283 
284  /**
285  Return true if settable at the command line
286  */
287  bool is_settable_at_command_line() { return option.id != -1; }
288 
289  bool register_option(std::vector<my_option> *array, int parse_flags) {
290  return is_settable_at_command_line() && (m_parse_flag & parse_flags) &&
291  (array->push_back(option), false);
292  }
293  void do_deprecated_warning(THD *thd);
294  /**
295  Create item from system variable value.
296 
297  @param thd pointer to THD object
298 
299  @return pointer to Item object or NULL if it's
300  impossible to obtain the value.
301  */
302  Item *copy_value(THD *thd);
303 
304  void save_default(THD *thd, set_var *var) { global_save_default(thd, var); }
305 
306  private:
307  virtual bool do_check(THD *thd, set_var *var) = 0;
308  /**
309  save the session default value of the variable in var
310  */
311  virtual void session_save_default(THD *thd, set_var *var) = 0;
312  /**
313  save the global default value of the variable in var
314  */
315  virtual void global_save_default(THD *thd, set_var *var) = 0;
316  virtual bool session_update(THD *thd, set_var *var) = 0;
317  virtual bool global_update(THD *thd, set_var *var) = 0;
318 
319  protected:
320  /**
321  A pointer to a value of the variable for SHOW.
322  It must be of show_val_type type (bool for SHOW_BOOL, int for SHOW_INT,
323  longlong for SHOW_LONGLONG, etc).
324  */
325  virtual uchar *session_value_ptr(THD *running_thd, THD *target_thd,
326  LEX_STRING *base);
327  virtual uchar *global_value_ptr(THD *thd, LEX_STRING *base);
328 
329  /**
330  A pointer to a storage area of the variable, to the raw data.
331  Typically it's the same as session_value_ptr(), but it's different,
332  for example, for ENUM, that is printed as a string, but stored as a number.
333  */
334  uchar *session_var_ptr(THD *thd);
335 
337 };
338 
339 /****************************************************************************
340  Classes for parsing of the SET command
341 ****************************************************************************/
342 
343 /**
344  A base class for everything that can be set with SET command.
345  It's similar to Items, an instance of this is created by the parser
346  for every assigmnent in SET (or elsewhere, e.g. in SELECT).
347 */
349  public:
351  virtual ~set_var_base() {}
352  virtual int resolve(THD *thd) = 0; ///< Check privileges & fix_fields
353  virtual int check(THD *thd) = 0; ///< Evaluate the expression
354  virtual int update(THD *thd) = 0; ///< Set the value
355  virtual void print(const THD *thd, String *str) = 0; ///< To self-print
356 
357  /**
358  @returns whether this variable is @@@@optimizer_trace.
359  */
360  virtual bool is_var_optimizer_trace() const { return false; }
361 
362  /**
363  Used only by prepared statements to resolve and check. No locking of tables
364  between the two phases.
365  */
366  virtual int light_check(THD *thd) { return (resolve(thd) || check(thd)); }
367 };
368 
369 /**
370  set_var_base descendant for assignments to the system variables.
371 */
372 class set_var : public set_var_base {
373  public:
374  sys_var *var; ///< system variable to be updated
375  Item *value; ///< the expression that provides the new value of the variable
377  union ///< temp storage to hold a value between sys_var::check and ::update
378  {
379  ulonglong ulonglong_value; ///< for all integer, set, enum sysvars
380  double double_value; ///< for Sys_var_double
381  plugin_ref plugin; ///< for Sys_var_plugin
382  Time_zone *time_zone; ///< for Sys_var_tz
383  LEX_STRING string_value; ///< for Sys_var_charptr and others
384  const void *ptr; ///< for Sys_var_struct
385  } save_result;
386  LEX_STRING
387  base; /**< for structured variables, like keycache_name.variable_name */
388 
389  set_var(enum_var_type type_arg, sys_var *var_arg,
390  const LEX_STRING *base_name_arg, Item *value_arg);
391 
392  int resolve(THD *thd);
393  int check(THD *thd);
394  int update(THD *thd);
396  int light_check(THD *thd);
397  /**
398  Print variable in short form.
399 
400  @param thd Thread handle.
401  @param str String buffer to append the partial assignment to.
402  */
403  void print_short(const THD *thd, String *str);
404  void print(const THD *, String *str); /* To self-print */
406  return (type == OPT_GLOBAL || type == OPT_PERSIST ||
408  }
409  virtual bool is_var_optimizer_trace() const {
411  return var == Sys_optimizer_trace_ptr;
412  }
413 };
414 
415 /* User variables like @my_own_variable */
416 class set_var_user : public set_var_base {
418 
419  public:
421  int resolve(THD *thd);
422  int check(THD *thd);
423  int update(THD *thd);
424  int light_check(THD *thd);
425  void print(const THD *thd, String *str); /* To self-print */
426 };
427 
428 /* For SET PASSWORD */
429 
432  char *password;
435 
436  public:
437  set_var_password(LEX_USER *user_arg, char *password_arg,
438  char *current_password_arg, bool retain_current);
439 
440  int resolve(THD *) { return 0; }
441  int check(THD *thd);
442  int update(THD *thd);
443  void print(const THD *thd, String *str); /* To self-print */
444 };
445 
446 /* For SET NAMES and SET CHARACTER SET */
447 
453 
454  public:
459  };
460  set_var_collation_client(int set_cs_flags_arg,
461  const CHARSET_INFO *client_coll_arg,
462  const CHARSET_INFO *connection_coll_arg,
463  const CHARSET_INFO *result_coll_arg)
464  : set_cs_flags(set_cs_flags_arg),
465  character_set_client(client_coll_arg),
466  character_set_results(result_coll_arg),
467  collation_connection(connection_coll_arg) {}
468  int resolve(THD *) { return 0; }
469  int check(THD *thd);
470  int update(THD *thd);
471  void print(const THD *thd, String *str); /* To self-print */
472 };
473 
474 /* optional things, have_* variables */
476 
482 
483 /*
484  Helper functions
485 */
489 
490 extern bool get_sysvar_source(const char *name, uint length,
491  enum enum_variable_source *source);
492 
493 bool enumerate_sys_vars(Show_var_array *show_var_array, bool sort,
494  enum enum_var_type type, bool strict);
495 void lock_plugin_mutex();
496 void unlock_plugin_mutex();
497 sys_var *find_sys_var(THD *thd, const char *str, size_t length = 0);
498 sys_var *find_sys_var_ex(THD *thd, const char *str, size_t length = 0,
499  bool throw_error = false, bool locked = false);
500 int sql_set_variables(THD *thd, List<set_var_base> *var_list, bool opened);
501 bool keyring_access_test();
503 
506  LEX_STRING *ls);
508  LEX_STRING *ls);
510 
512 extern sys_var *Sys_gtid_next_ptr;
515 
517 
518 const CHARSET_INFO *get_old_charset_by_name(const char *old_name);
519 
520 int sys_var_init();
521 int sys_var_add_options(std::vector<my_option> *long_options, int parse_flags);
522 void sys_var_end(void);
523 
524 /* check needed privileges to perform SET PERSIST[_only] or RESET PERSIST */
525 bool check_priv(THD *thd, bool static_variable);
526 
527 #define PERSIST_ONLY_ADMIN_X509_SUBJECT "persist_only_admin_x509_subject"
528 #define PERSISTED_GLOBALS_LOAD "persisted_globals_load"
530 
531 #endif
Definition: set_var.h:108
LEX_CSTRING name
Definition: set_var.h:104
bool is_trilevel() const
Definition: set_var.h:242
Item * copy_value(THD *thd)
Create item from system variable value.
Definition: set_var.cc:462
get_opt_arg_type
Enumeration of the my_option::arg_type attributes.
Definition: my_getopt.h:78
ulonglong timestamp
Definition: set_var.h:156
Definition: sql_plugin_ref.h:44
Definition: set_var.h:448
Definition: set_var.h:107
SHOW_COMP_OPTION have_rtree_keys
Definition: mysqld.cc:1282
unsigned long long int ulonglong
Definition: my_inttypes.h:69
const CHARSET_INFO * charset(THD *thd)
Definition: set_var.cc:550
virtual void print(const THD *thd, String *str)=0
To self-print.
const CHARSET_INFO * character_set_client
Definition: set_var.h:450
unsigned char uchar
Definition: my_inttypes.h:49
int m_parse_flag
either PARSE_EARLY or PARSE_NORMAL.
Definition: set_var.h:144
enum sys_var::binlog_status_enum binlog_status
sys_var * Sys_gtid_next_ptr
Definition: sys_vars.cc:5848
void set_source_name(const char *path)
Definition: set_var.h:203
Item_result
Type of the user defined function return slot and arguments
Definition: udf_registration_types.h:38
virtual bool is_default(THD *thd, set_var *var)
Definition: set_var.cc:393
Definition: set_var.h:430
bool is_global_persist()
Definition: set_var.h:405
virtual uchar * global_value_ptr(THD *thd, LEX_STRING *base)
Definition: set_var.cc:334
char * password
Definition: set_var.h:432
virtual void update_default(longlong new_def_value)
Definition: set_var.h:183
Definition: mysql_lex_string.h:34
std::unordered_map, but with my_malloc and collation-aware comparison.
Definition: map_helpers.h:236
Defines for getting and processing the current system type programmatically.
int check(THD *thd)
Check the validity of the SET PASSWORD request.
Definition: set_var.cc:1246
Definition: set_var.h:109
int sql_set_variables(THD *thd, List< set_var_base > *var_list, bool opened)
Execute update of all variables.
Definition: set_var.cc:793
Definition: set_var.h:110
collation_unordered_map< std::string, sys_var * > * get_system_variable_hash(void)
Definition: set_var.cc:78
static int opened
Definition: log_filter_dragnet.cc:121
void print(const THD *thd, String *str)
To self-print.
Definition: set_var.cc:1262
on_check_function on_check
Definition: set_var.h:149
int mysql_add_sys_var_chain(sys_var *chain)
Add variables to the dynamic hash of system variables.
Definition: set_var.cc:600
const string name("\ame\)
const CHARSET_INFO * collation_connection
Definition: set_var.h:452
Prealloced_array< SHOW_VAR, SHOW_VAR_PREALLOC > Show_var_array
Definition: set_var.h:76
void set_timestamp(ulonglong ts)
Definition: set_var.h:214
option_id_t id
option id as in enum option_id
Definition: innodb_config.h:181
File containing constants that can be used throughout the server.
Definition: set_var.h:114
Some integer typedefs for easier portability.
sys_var * last
Definition: set_var.h:80
int light_check(THD *thd)
Check variable, but without assigning value (used by PS).
Definition: set_var.cc:1194
void print_short(const THD *thd, String *str)
Print variable in short form.
Definition: set_var.cc:1126
#define bool
Definition: config_static.h:42
Definition: set_var.h:134
void set_user(const char *usr)
Definition: set_var.h:206
#define USERNAME_CHAR_LENGTH
Definition: mysql_com.h:62
static const int PARSE_NORMAL
Definition: set_var.h:128
set_var_collation_client(int set_cs_flags_arg, const CHARSET_INFO *client_coll_arg, const CHARSET_INFO *connection_coll_arg, const CHARSET_INFO *result_coll_arg)
Definition: set_var.h:460
bool check(THD *thd, set_var *var)
Definition: set_var.cc:346
longlong get_default()
Definition: set_var.h:186
int mysql_del_sys_var_chain(sys_var *chain)
Definition: set_var.cc:635
virtual uchar * session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *base)
A pointer to a value of the variable for SHOW.
Definition: set_var.cc:330
sys_var * Sys_gtid_next_list_ptr
virtual longlong get_min_value()
Definition: set_var.h:188
Definition: mysql_lex_string.h:39
set_var(enum_var_type type_arg, sys_var *var_arg, const LEX_STRING *base_name_arg, Item *value_arg)
Definition: set_var.cc:867
ulong get_system_variable_hash_records(void)
Definition: set_var.cc:667
ulonglong sql_mode_t
Definition: set_var.h:64
void set_user_host(THD *thd)
Definition: set_var.cc:427
const char * get_host()
Definition: set_var.h:208
int check(THD *thd)
Verify that the supplied value is correct.
Definition: set_var.cc:1024
bool check_priv(THD *thd, bool static_variable)
This function will check for necessary privileges needed to perform RESET PERSIST or SET PERSIST[_ONL...
Definition: set_var.cc:172
Definition: set_var.h:416
bool is_readonly() const
Definition: set_var.h:240
ulonglong get_system_variable_hash_version(void)
Definition: set_var.cc:675
LEX_USER * user
Definition: set_var.h:431
char * sys_var_persist_only_admin_x509_subject
global X509 subject name to require from the client session to allow SET PERSIST[_ONLY] on sys_var::N...
Definition: set_var.cc:896
bool set_default(THD *thd, set_var *var)
Update the system variable with the default value from either session or global scope.
Definition: set_var.cc:382
void set_host(const char *hst)
Definition: set_var.h:209
uchar * session_var_ptr(THD *thd)
A pointer to a storage area of the variable, to the raw data.
Definition: set_var.cc:338
enum_var_type type
Definition: set_var.h:376
This class represents abstract time zone and provides basic interface for MYSQL_TIME <-> my_time_t co...
Definition: tztime.h:51
void print(const THD *, String *str)
Self-print assignment.
Definition: set_var.cc:1141
const char *const deprecation_substitute
Definition: set_var.h:151
Definition: set_var.h:78
virtual void session_save_default(THD *thd, set_var *var)=0
save the session default value of the variable in var
enum_mysql_show_type
Declarations for SHOW STATUS support in plugins.
Definition: status_var.h:29
ulonglong ulonglong_value
for all integer, set, enum sysvars
Definition: set_var.h:379
Using this class is fraught with peril, and you need to be very careful when doing so...
Definition: sql_string.h:159
const void * ptr
for Sys_var_struct
Definition: set_var.h:384
Definition: set_var.h:106
virtual ulong get_var_type()
Returns variable type.
Definition: set_var.h:195
const CHARSET_INFO * character_set_results
Definition: set_var.h:451
virtual bool is_var_optimizer_trace() const
Definition: set_var.h:409
enum_variable_source get_source()
Definition: set_var.h:198
SHOW_COMP_OPTION have_dlopen
Definition: mysqld.cc:1281
bool is_struct()
the following is only true for keycache variables, that support the syntax @keycache_name.variable_name
Definition: set_var.h:255
void sys_var_end(void)
Definition: set_var.cc:150
Common definition between mysql server & client.
sys_var * find_sys_var_ex(THD *thd, const char *str, size_t length=0, bool throw_error=false, bool locked=false)
Definition: sql_plugin.cc:2571
enum_variable_source
This enum values define how system variables are set.
Definition: system_variable_source_type.h:32
virtual int check(THD *thd)=0
Evaluate the expression.
set_var_base descendant for assignments to the system variables.
Definition: set_var.h:372
strcpy(retval, s)
int sys_var_add_options(std::vector< my_option > *long_options, int parse_flags)
Definition: set_var.cc:136
TYPELIB bool_typelib
Definition: sys_vars.cc:142
wrapper to hide a mutex and an rwlock under a common interface
Definition: sys_vars_shared.h:49
bool(* on_update_function)(sys_var *self, THD *thd, enum_var_type type)
Definition: set_var.h:140
There can be some variables which needs to be set before plugin is loaded.
Definition: set_var.h:125
Time_zone * time_zone
for Sys_var_tz
Definition: set_var.h:382
char host[HOSTNAME_LENGTH]
Definition: set_var.h:155
SHOW_COMP_OPTION have_geometry
Definition: mysqld.cc:1282
Definition: set_var.h:135
int flags
or&#39;ed flag_enum values
Definition: set_var.h:143
Definition: table.h:2339
virtual bool is_var_optimizer_trace() const
Definition: set_var.h:360
void print(const THD *thd, String *str)
To self-print.
Definition: set_var.cc:1326
virtual void set_is_plugin(bool)
Definition: set_var.h:197
A class representing one system variable - that is something that can be accessed as @global...
Definition: set_var.h:101
structure to define some default "config_option" option settings
Definition: innodb_config.h:180
Definition: set_var.h:115
virtual bool is_non_persistent()
Definition: set_var.h:220
LEX_STRING string_value
for Sys_var_charptr and others
Definition: set_var.h:383
int resolve(THD *)
Check privileges & fix_fields.
Definition: set_var.h:440
bool is_global_persist(enum_var_type type)
Definition: set_var.h:279
Definition: set_var.h:111
flag_enum
Definition: set_var.h:105
enum enum_mysql_show_type SHOW_TYPE
Definition: set_var.h:67
export sys_var * Sys_optimizer_trace_ptr
Definition: sys_vars.cc:2992
Definition: set_var.h:88
ptrdiff_t offset
offset to the value from global_system_variables
Definition: set_var.h:148
set_var_user(Item_func_set_user_var *item)
Definition: set_var.h:420
Definition: aggregate_check.h:523
virtual void saved_value_to_string(THD *thd, set_var *var, char *def_val)=0
This function converts value stored in save_result to string.
void unlock_plugin_mutex()
Definition: sql_plugin.cc:2569
int update(THD *thd)
Set the value.
Definition: set_var.cc:1202
virtual int light_check(THD *thd)
Used only by prepared statements to resolve and check.
Definition: set_var.h:366
Definition: set_var.h:113
virtual ulonglong get_max_value()
Definition: set_var.h:189
bool not_visible() const
Definition: set_var.h:241
SHOW_COMP_OPTION have_profiling
Definition: mysqld.cc:1284
virtual int update(THD *thd)=0
Set the value.
int scope() const
Definition: set_var.h:238
static char * path
Definition: mysqldump.cc:122
sql_mode_t expand_sql_mode(sql_mode_t sql_mode, THD *thd)
Definition: sys_vars.cc:4143
virtual ~sys_var()
Definition: set_var.h:167
bool fix_delay_key_write(sys_var *self, THD *thd, enum_var_type type)
Definition: sys_vars.cc:1752
Definition: sql_plugin_var.h:195
bool keyring_access_test()
This function is used to check if key management UDFs like keying_key_generate/store/remove should pr...
Definition: set_var.cc:855
int update(THD *thd)
Set the value.
Definition: set_var.cc:1254
bool retain_current_password
Definition: set_var.h:434
#define GET_ASK_ADDR
Definition: my_getopt.h:68
Definition: item.h:666
SHOW_COMP_OPTION have_statement_timeout
Definition: mysqld.cc:1285
virtual bool global_update(THD *thd, set_var *var)=0
unsigned int uint
Definition: uca-dump.cc:29
Definition: set_var.h:91
int light_check(THD *thd)
Check variable, but without assigning value (used by PS).
Definition: set_var.cc:1057
set_cs_flags_enum
Definition: set_var.h:455
long long int longlong
Definition: my_inttypes.h:70
void update_parser_max_mem_size()
Definition: sys_vars.cc:2922
Definition: my_getopt.h:90
bool update(THD *thd, set_var *var)
Definition: set_var.cc:286
virtual void global_save_default(THD *thd, set_var *var)=0
save the global default value of the variable in var
PolyLock * guard
second lock that protects the variable
Definition: set_var.h:147
#define HOSTNAME_LENGTH
Definition: mysql_com.h:54
Definition: set_var.h:90
char user[USERNAME_CHAR_LENGTH]
Definition: set_var.h:154
int set_cs_flags
Definition: set_var.h:449
A base class for everything that can be set with SET command.
Definition: set_var.h:348
virtual sys_var_pluginvar * cast_pluginvar()
downcast for sys_var_pluginvar.
Definition: set_var.h:177
void set_source(enum_variable_source src)
Definition: set_var.h:200
Definition: m_ctype.h:358
on_update_function on_update
Definition: set_var.h:150
uchar * global_var_ptr()
Definition: set_var.cc:342
Common header for many mysys elements.
void update_source_user_host_timestamp(THD *thd)
Update variable source, user, host and timestamp values.
Definition: set_var.cc:1087
Item * value
the expression that provides the new value of the variable
Definition: set_var.h:375
virtual int resolve(THD *thd)=0
Check privileges & fix_fields.
void do_deprecated_warning(THD *thd)
Definition: set_var.cc:441
unsigned long long int my_micro_time()
Return time in microseconds.
Definition: my_systime.h:182
set_var_base()
Definition: set_var.h:350
Definition: typelib.h:34
SHOW_COMP_OPTION have_query_cache
Definition: mysqld.cc:1281
SHOW_TYPE show_type()
Definition: set_var.h:237
union set_var::@66 save_result
int update(THD *thd)
Update variable.
Definition: set_var.cc:1106
virtual void cleanup()
All the cleanup procedures should be performed here.
Definition: set_var.h:172
SHOW_COMP_OPTION
Definition: sql_const.h:376
int sys_var_init()
Definition: set_var.cc:114
int resolve(THD *thd)
Check privileges & fix_fields.
Definition: set_var.cc:1166
virtual void set_arg_source(get_opt_arg_source *)
Definition: set_var.h:196
bool sql_mode_quoted_string_representation(THD *thd, sql_mode_t sql_mode, LEX_STRING *ls)
Definition: sys_vars.cc:4256
virtual bool check_update_type(Item_result type)=0
enum_var_type
Definition: set_var.h:86
SHOW_COMP_OPTION have_symlink
Definition: mysqld.cc:1281
int type
Definition: http_common.h:411
bool is_os_charset
true if the value is in character_set_filesystem
Definition: set_var.h:152
bool sql_mode_string_representation(THD *thd, sql_mode_t sql_mode, LEX_STRING *ls)
Definition: sys_vars.cc:4251
bool check_scope(enum_var_type query_type)
Return true for success if: Global query and variable scope is GLOBAL or SESSION, or Session query an...
Definition: set_var.h:266
my_option * get_option()
Definition: set_var.h:212
bool enumerate_sys_vars(Show_var_array *show_var_array, bool sort, enum enum_var_type type, bool strict)
Constructs an array of system variables for display to the user.
Definition: set_var.cc:689
bool get_sysvar_source(const char *name, uint length, enum enum_variable_source *source)
Get source of a given system variable given its name and name length.
Definition: set_var.cc:88
int update(THD *thd)
Set the value.
Definition: set_var.cc:1296
Definition: my_getopt.h:80
Definition: set_var.h:87
sys_var(sys_var_chain *chain, const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, int getopt_id, enum get_opt_arg_type getopt_arg_type, SHOW_TYPE show_val_type_arg, longlong def_val, PolyLock *lock, enum binlog_status_enum binlog_status_arg, on_check_function on_check_func, on_update_function on_update_func, const char *substitute, int parse_flag)
sys_var constructor
Definition: set_var.cc:226
Definition: set_var.h:112
sys_var * next
Definition: set_var.h:103
void lock_plugin_mutex()
Definition: sql_plugin.cc:2567
ulonglong sql_mode_t
Definition: dd_event.h:36
enum_mysql_show_scope
Status variable scope.
Definition: status_var.h:67
int check(THD *thd)
Evaluate the expression.
Definition: set_var.cc:1286
virtual bool session_update(THD *thd, set_var *var)=0
sys_var * var
system variable to be updated
Definition: set_var.h:374
bool is_hint_updateable() const
Check if the variable can be set using SET_VAR hint.
Definition: set_var.h:250
char m_path_name[FN_REFLEN]
config file path OR compiled default values
Definition: my_getopt.h:84
virtual ~set_var_base()
Definition: set_var.h:351
ulonglong get_timestamp() const
Definition: set_var.h:210
plugin_ref plugin
for Sys_var_plugin
Definition: set_var.h:381
SHOW_COMP_OPTION have_compress
Definition: mysqld.cc:1283
A better implementation of the UNIX ctype(3) library.
my_option option
min, max, default values are stored here
Definition: set_var.h:146
char * current_password
Definition: set_var.h:433
bool is_persist_readonly() const
Definition: set_var.h:243
void save_default(THD *thd, set_var *var)
Definition: set_var.h:304
void clear_user_host_timestamp()
Definition: set_var.h:215
enum enum_variable_source m_source
Definition: my_getopt.h:85
const char * get_source_name()
Definition: set_var.h:199
#define GET_TYPE_MASK
Definition: my_getopt.h:69
const SHOW_TYPE show_val_type
what value_ptr() returns for sql_show.cc
Definition: set_var.h:145
static const char * sql_mode
Definition: mysqlslap.cc:188
int resolve(THD *)
Check privileges & fix_fields.
Definition: set_var.h:468
Definition: item_func.h:2972
sys_var * Sys_autocommit_ptr
Definition: sys_vars.cc:4722
set_var_password(LEX_USER *user_arg, char *password_arg, char *current_password_arg, bool retain_current)
Definition: set_var.cc:1223
int resolve(THD *thd)
Resolve the variable assignment
Definition: set_var.cc:967
const CHARSET_INFO * get_old_charset_by_name(const char *old_name)
Definition: set_var.cc:572
bool register_option(std::vector< my_option > *array, int parse_flags)
Definition: set_var.h:289
ulonglong system_variable_hash_version
Definition: set_var.cc:76
unsigned long ulong
Definition: my_inttypes.h:46
double double_value
for Sys_var_double
Definition: set_var.h:380
struct get_opt_arg_source source
Definition: set_var.h:153
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:75
LEX_STRING base
for structured variables, like keycache_name.variable_name
Definition: set_var.h:387
virtual bool do_check(THD *thd, set_var *var)=0
sys_var * Sys_gtid_purged_ptr
Definition: sys_vars.cc:5939
bool is_written_to_binlog(enum_var_type type)
Definition: set_var.h:256
enum enum_mysql_show_scope SHOW_SCOPE
Definition: set_var.h:68
uchar * value_ptr(THD *running_thd, THD *target_thd, enum_var_type type, LEX_STRING *base)
Definition: set_var.cc:368
binlog_status_enum
Enumeration type to indicate for a system variable whether it will be written to the binlog or not...
Definition: set_var.h:133
static const int PARSE_EARLY
Definition: set_var.h:127
bool is_settable_at_command_line()
Return true if settable at the command line.
Definition: set_var.h:287
bool(* on_check_function)(sys_var *self, THD *thd, set_var *var)
Definition: set_var.h:139
#define comment
Definition: lexyy.cc:959
sys_var * find_sys_var(THD *thd, const char *str, size_t length=0)
Definition: sql_plugin.cc:2600
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:776
int check(THD *thd)
Evaluate the expression.
Definition: set_var.cc:1174
void print(const THD *thd, String *str)
To self-print.
Definition: set_var.cc:1215
void set_timestamp()
Definition: set_var.h:213
Item_func_set_user_var * user_var_item
Definition: set_var.h:417
Definition: set_var.h:89
sys_var * first
Definition: set_var.h:79
const char * get_user()
Definition: set_var.h:207