MySQL  8.0.17
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_hostname.h" // HOSTNAME_LENGTH
42 #include "my_inttypes.h"
43 #include "my_sys.h"
44 #include "my_systime.h" // my_micro_time()
46 #include "mysql/status_var.h"
48 #include "mysql_com.h" // Item_result
49 #include "prealloced_array.h" // Prealloced_array
50 #include "sql/sql_const.h" // SHOW_COMP_OPTION
51 #include "sql/sql_plugin_ref.h" // plugin_ref
52 #include "typelib.h" // TYPELIB
53 
54 class Item;
56 class PolyLock;
57 class String;
58 class THD;
59 class Time_zone;
60 class set_var;
61 class sys_var;
62 class sys_var_pluginvar;
63 struct LEX_USER;
64 template <class Key, class Value>
66 
67 typedef ulonglong sql_mode_t;
70 template <class T>
71 class List;
72 
73 extern TYPELIB bool_typelib;
74 
75 /* Number of system variable elements to preallocate. */
76 #define SHOW_VAR_PREALLOC 200
78 
79 struct sys_var_chain {
82 };
83 
86 
87 enum enum_var_type : int {
93 };
94 
95 /**
96  A class representing one system variable - that is something
97  that can be accessed as @@global.variable_name or @@session.variable_name,
98  visible in SHOW xxx VARIABLES and in INFORMATION_SCHEMA.xxx_VARIABLES,
99  optionally it can be assigned to, optionally it can have a command-line
100  counterpart with the same name.
101 */
102 class sys_var {
103  public:
106  enum flag_enum {
107  GLOBAL = 0x0001,
108  SESSION = 0x0002,
109  ONLY_SESSION = 0x0004,
110  SCOPE_MASK = 0x03FF, // 1023
111  READONLY = 0x0400, // 1024
112  ALLOCATED = 0x0800, // 2048
113  INVISIBLE = 0x1000, // 4096
114  TRI_LEVEL = 0x2000, // 8192 - default is neither GLOBAL nor SESSION
115  NOTPERSIST = 0x4000,
116  HINT_UPDATEABLE = 0x8000, // Variable is updateable using SET_VAR hint
117  /**
118  There can be some variables which needs to be set before plugin is loaded.
119  ex: binlog_checksum needs to be set before GR plugin is loaded.
120  Also, there are some variables which needs to be set before some server
121  internal component initialization.
122  ex: binlog_encryption needs to be set before binary and relay log
123  files generation.
124  */
125 
127  };
128  static const int PARSE_EARLY = 1;
129  static const int PARSE_NORMAL = 2;
130  /**
131  Enumeration type to indicate for a system variable whether
132  it will be written to the binlog or not.
133  */
137  } binlog_status;
138 
139  protected:
140  typedef bool (*on_check_function)(sys_var *self, THD *thd, set_var *var);
141  typedef bool (*on_update_function)(sys_var *self, THD *thd,
143 
144  int flags; ///< or'ed flag_enum values
145  int m_parse_flag; ///< either PARSE_EARLY or PARSE_NORMAL.
146  const SHOW_TYPE show_val_type; ///< what value_ptr() returns for sql_show.cc
147  my_option option; ///< min, max, default values are stored here
148  PolyLock *guard; ///< *second* lock that protects the variable
149  ptrdiff_t offset; ///< offset to the value from global_system_variables
152  const char *const deprecation_substitute;
153  bool is_os_charset; ///< true if the value is in character_set_filesystem
155  char user[USERNAME_CHAR_LENGTH + 1]; /* which user has set this variable */
156  char host[HOSTNAME_LENGTH + 1]; /* host on which this variable is set */
157  ulonglong timestamp; /* represents when this variable was set */
158 
159  public:
160  sys_var(sys_var_chain *chain, const char *name_arg, const char *comment,
161  int flag_args, ptrdiff_t off, int getopt_id,
162  enum get_opt_arg_type getopt_arg_type, SHOW_TYPE show_val_type_arg,
163  longlong def_val, PolyLock *lock,
164  enum binlog_status_enum binlog_status_arg,
165  on_check_function on_check_func, on_update_function on_update_func,
166  const char *substitute, int parse_flag);
167 
168  virtual ~sys_var() {}
169 
170  /**
171  All the cleanup procedures should be performed here
172  */
173  virtual void cleanup() {}
174  /**
175  downcast for sys_var_pluginvar. Returns this if it's an instance
176  of sys_var_pluginvar, and 0 otherwise.
177  */
178  virtual sys_var_pluginvar *cast_pluginvar() { return 0; }
179 
180  bool check(THD *thd, set_var *var);
181  const uchar *value_ptr(THD *running_thd, THD *target_thd, enum_var_type type,
182  LEX_STRING *base);
183  const uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
184  virtual void update_default(longlong new_def_value) {
185  option.def_value = new_def_value;
186  }
187  longlong get_default() { return option.def_value; }
188  virtual bool is_default(THD *thd, set_var *var);
189  virtual longlong get_min_value() { return option.min_value; }
190  virtual ulonglong get_max_value() { return option.max_value; }
191  /**
192  Returns variable type.
193 
194  @return variable type
195  */
196  virtual ulong get_var_type() { return (option.var_type & GET_TYPE_MASK); }
198  virtual void set_is_plugin(bool) {}
200  const char *get_source_name() { return source.m_path_name; }
202  option.arg_source->m_source = src;
203  }
204  bool set_source_name(const char *path) {
205  return set_and_truncate(option.arg_source->m_path_name, path,
206  sizeof(option.arg_source->m_path_name));
207  }
208  bool set_user(const char *usr) {
209  return set_and_truncate(user, usr, sizeof(user));
210  }
211  const char *get_user() { return user; }
212  const char *get_host() { return host; }
213  bool set_host(const char *hst) {
214  return set_and_truncate(host, hst, sizeof(host));
215  }
216  ulonglong get_timestamp() const { return timestamp; }
217  void set_user_host(THD *thd);
218  my_option *get_option() { return &option; }
220  void set_timestamp(ulonglong ts) { timestamp = ts; }
222  user[0] = '\0';
223  host[0] = '\0';
224  timestamp = 0;
225  }
226  virtual bool is_non_persistent() { return flags & NOTPERSIST; }
227 
228  /**
229  Update the system variable with the default value from either
230  session or global scope. The default value is stored in the
231  'var' argument. Return false when successful.
232  */
233  bool set_default(THD *thd, set_var *var);
234  bool update(THD *thd, set_var *var);
235 
236  /**
237  This function converts value stored in save_result to string. This
238  function must ba called after calling save_default() as save_default() will
239  store default value to save_result.
240  */
241  virtual void saved_value_to_string(THD *thd, set_var *var, char *def_val) = 0;
242 
244  int scope() const { return flags & SCOPE_MASK; }
245  const CHARSET_INFO *charset(THD *thd);
246  bool is_readonly() const { return flags & READONLY; }
247  bool not_visible() const { return flags & INVISIBLE; }
248  bool is_trilevel() const { return flags & TRI_LEVEL; }
249  bool is_persist_readonly() const { return flags & PERSIST_AS_READ_ONLY; }
250  /**
251  Check if the variable can be set using SET_VAR hint.
252 
253  @return true if the variable can be set using SET_VAR hint,
254  false otherwise.
255  */
256  bool is_hint_updateable() const { return flags & HINT_UPDATEABLE; }
257  /**
258  the following is only true for keycache variables,
259  that support the syntax @@keycache_name.variable_name
260  */
261  bool is_struct() { return option.var_type & GET_ASK_ADDR; }
264  }
265  virtual bool check_update_type(Item_result type) = 0;
266 
267  /**
268  Return true for success if:
269  Global query and variable scope is GLOBAL or SESSION, or
270  Session query and variable scope is SESSION or ONLY_SESSION.
271  */
272  bool check_scope(enum_var_type query_type) {
273  switch (query_type) {
274  case OPT_PERSIST:
275  case OPT_PERSIST_ONLY:
276  case OPT_GLOBAL:
277  return scope() & (GLOBAL | SESSION);
278  case OPT_SESSION:
279  return scope() & (SESSION | ONLY_SESSION);
280  case OPT_DEFAULT:
281  return scope() & (SESSION | ONLY_SESSION);
282  }
283  return false;
284  }
286  return (type == OPT_GLOBAL || type == OPT_PERSIST ||
288  }
289 
290  /**
291  Return true if settable at the command line
292  */
293  bool is_settable_at_command_line() { return option.id != -1; }
294 
295  bool register_option(std::vector<my_option> *array, int parse_flags) {
296  return is_settable_at_command_line() && (m_parse_flag & parse_flags) &&
297  (array->push_back(option), false);
298  }
299  void do_deprecated_warning(THD *thd);
300  /**
301  Create item from system variable value.
302 
303  @param thd pointer to THD object
304 
305  @return pointer to Item object or NULL if it's
306  impossible to obtain the value.
307  */
308  Item *copy_value(THD *thd);
309 
310  void save_default(THD *thd, set_var *var) { global_save_default(thd, var); }
311 
312  private:
313  inline static bool set_and_truncate(char *dst, const char *string,
314  size_t sizeof_dst) {
315  size_t string_length = strlen(string), length;
316  length = std::min(sizeof_dst - 1, string_length);
317  memcpy(dst, string, length);
318  dst[length] = 0;
319  return length < string_length; // truncated
320  }
321  virtual bool do_check(THD *thd, set_var *var) = 0;
322  /**
323  save the session default value of the variable in var
324  */
325  virtual void session_save_default(THD *thd, set_var *var) = 0;
326  /**
327  save the global default value of the variable in var
328  */
329  virtual void global_save_default(THD *thd, set_var *var) = 0;
330  virtual bool session_update(THD *thd, set_var *var) = 0;
331  virtual bool global_update(THD *thd, set_var *var) = 0;
332 
333  protected:
334  /**
335  A pointer to a value of the variable for SHOW.
336  It must be of show_val_type type (bool for SHOW_BOOL, int for SHOW_INT,
337  longlong for SHOW_LONGLONG, etc).
338  */
339  virtual const uchar *session_value_ptr(THD *running_thd, THD *target_thd,
340  LEX_STRING *base);
341  virtual const uchar *global_value_ptr(THD *thd, LEX_STRING *base);
342 
343  /**
344  A pointer to a storage area of the variable, to the raw data.
345  Typically it's the same as session_value_ptr(), but it's different,
346  for example, for ENUM, that is printed as a string, but stored as a number.
347  */
348  uchar *session_var_ptr(THD *thd);
349 
351 };
352 
353 /****************************************************************************
354  Classes for parsing of the SET command
355 ****************************************************************************/
356 
357 /**
358  A base class for everything that can be set with SET command.
359  It's similar to Items, an instance of this is created by the parser
360  for every assigmnent in SET (or elsewhere, e.g. in SELECT).
361 */
363  public:
365  virtual ~set_var_base() {}
366  virtual int resolve(THD *thd) = 0; ///< Check privileges & fix_fields
367  virtual int check(THD *thd) = 0; ///< Evaluate the expression
368  virtual int update(THD *thd) = 0; ///< Set the value
369  virtual void print(const THD *thd, String *str) = 0; ///< To self-print
370 
371  /**
372  @returns whether this variable is @@@@optimizer_trace.
373  */
374  virtual bool is_var_optimizer_trace() const { return false; }
375 
376  /**
377  Used only by prepared statements to resolve and check. No locking of tables
378  between the two phases.
379  */
380  virtual int light_check(THD *thd) { return (resolve(thd) || check(thd)); }
381 };
382 
383 /**
384  set_var_base descendant for assignments to the system variables.
385 */
386 class set_var : public set_var_base {
387  public:
388  sys_var *var; ///< system variable to be updated
389  Item *value; ///< the expression that provides the new value of the variable
391  union ///< temp storage to hold a value between sys_var::check and ::update
392  {
393  ulonglong ulonglong_value; ///< for all integer, set, enum sysvars
394  double double_value; ///< for Sys_var_double
395  plugin_ref plugin; ///< for Sys_var_plugin
396  Time_zone *time_zone; ///< for Sys_var_tz
397  LEX_STRING string_value; ///< for Sys_var_charptr and others
398  const void *ptr; ///< for Sys_var_struct
399  } save_result;
400  LEX_STRING
401  base; /**< for structured variables, like keycache_name.variable_name */
402 
403  set_var(enum_var_type type_arg, sys_var *var_arg,
404  const LEX_STRING *base_name_arg, Item *value_arg);
405 
406  int resolve(THD *thd);
407  int check(THD *thd);
408  int update(THD *thd);
410  int light_check(THD *thd);
411  /**
412  Print variable in short form.
413 
414  @param thd Thread handle.
415  @param str String buffer to append the partial assignment to.
416  */
417  void print_short(const THD *thd, String *str);
418  void print(const THD *, String *str); /* To self-print */
420  return (type == OPT_GLOBAL || type == OPT_PERSIST ||
422  }
423  virtual bool is_var_optimizer_trace() const {
425  return var == Sys_optimizer_trace_ptr;
426  }
427 };
428 
429 /* User variables like @my_own_variable */
430 class set_var_user : public set_var_base {
432 
433  public:
435  int resolve(THD *thd);
436  int check(THD *thd);
437  int update(THD *thd);
438  int light_check(THD *thd);
439  void print(const THD *thd, String *str); /* To self-print */
440 };
441 
442 /* For SET PASSWORD */
443 
446  char *password;
449 
450  public:
451  set_var_password(LEX_USER *user_arg, char *password_arg,
452  char *current_password_arg, bool retain_current);
453 
454  int resolve(THD *) { return 0; }
455  int check(THD *thd);
456  int update(THD *thd);
457  void print(const THD *thd, String *str); /* To self-print */
458 };
459 
460 /* For SET NAMES and SET CHARACTER SET */
461 
467 
468  public:
473  };
474  set_var_collation_client(int set_cs_flags_arg,
475  const CHARSET_INFO *client_coll_arg,
476  const CHARSET_INFO *connection_coll_arg,
477  const CHARSET_INFO *result_coll_arg)
478  : set_cs_flags(set_cs_flags_arg),
479  character_set_client(client_coll_arg),
480  character_set_results(result_coll_arg),
481  collation_connection(connection_coll_arg) {}
482  int resolve(THD *) { return 0; }
483  int check(THD *thd);
484  int update(THD *thd);
485  void print(const THD *thd, String *str); /* To self-print */
486 };
487 
488 /* optional things, have_* variables */
490 
496 
497 /*
498  Helper functions
499 */
503 
504 extern bool get_sysvar_source(const char *name, uint length,
505  enum enum_variable_source *source);
506 
507 bool enumerate_sys_vars(Show_var_array *show_var_array, bool sort,
508  enum enum_var_type type, bool strict);
509 void lock_plugin_mutex();
510 void unlock_plugin_mutex();
511 sys_var *find_sys_var(THD *thd, const char *str, size_t length = 0);
512 sys_var *find_sys_var_ex(THD *thd, const char *str, size_t length = 0,
513  bool throw_error = false, bool locked = false);
514 int sql_set_variables(THD *thd, List<set_var_base> *var_list, bool opened);
515 bool keyring_access_test();
517 
520  LEX_STRING *ls);
522  LEX_STRING *ls);
524 
526 extern sys_var *Sys_gtid_next_ptr;
529 
531 
532 const CHARSET_INFO *get_old_charset_by_name(const char *old_name);
533 
534 int sys_var_init();
535 int sys_var_add_options(std::vector<my_option> *long_options, int parse_flags);
536 void sys_var_end(void);
537 
538 /* check needed privileges to perform SET PERSIST[_only] or RESET PERSIST */
539 bool check_priv(THD *thd, bool static_variable);
540 
541 #define PERSIST_ONLY_ADMIN_X509_SUBJECT "persist_only_admin_x509_subject"
542 #define PERSISTED_GLOBALS_LOAD "persisted_globals_load"
544 
545 #endif
Definition: set_var.h:109
LEX_CSTRING name
Definition: set_var.h:105
bool is_trilevel() const
Definition: set_var.h:248
Item * copy_value(THD *thd)
Create item from system variable value.
Definition: set_var.cc:464
get_opt_arg_type
Enumeration of the my_option::arg_type attributes.
Definition: my_getopt.h:78
ulonglong timestamp
Definition: set_var.h:157
Definition: sql_plugin_ref.h:44
Definition: set_var.h:462
Definition: set_var.h:108
SHOW_COMP_OPTION have_rtree_keys
Definition: mysqld.cc:1326
unsigned long long int ulonglong
Definition: my_inttypes.h:74
const CHARSET_INFO * charset(THD *thd)
Definition: set_var.cc:556
virtual void print(const THD *thd, String *str)=0
To self-print.
const CHARSET_INFO * character_set_client
Definition: set_var.h:464
unsigned char uchar
Definition: my_inttypes.h:51
int m_parse_flag
either PARSE_EARLY or PARSE_NORMAL.
Definition: set_var.h:145
enum sys_var::binlog_status_enum binlog_status
sys_var * Sys_gtid_next_ptr
Definition: sys_vars.cc:5943
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:394
Definition: set_var.h:444
bool is_global_persist()
Definition: set_var.h:419
virtual const 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
char * password
Definition: set_var.h:446
virtual void update_default(longlong new_def_value)
Definition: set_var.h:184
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:1253
Definition: set_var.h:110
int sql_set_variables(THD *thd, List< set_var_base > *var_list, bool opened)
Execute update of all variables.
Definition: set_var.cc:800
Definition: set_var.h:111
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:1269
on_check_function on_check
Definition: set_var.h:150
int mysql_add_sys_var_chain(sys_var *chain)
Add variables to the dynamic hash of system variables.
Definition: set_var.cc:606
const string name("\ame\)
const CHARSET_INFO * collation_connection
Definition: set_var.h:466
Prealloced_array< SHOW_VAR, SHOW_VAR_PREALLOC > Show_var_array
Definition: set_var.h:77
void set_timestamp(ulonglong ts)
Definition: set_var.h:220
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:115
Some integer typedefs for easier portability.
sys_var * last
Definition: set_var.h:81
int light_check(THD *thd)
Check variable, but without assigning value (used by PS).
Definition: set_var.cc:1201
void print_short(const THD *thd, String *str)
Print variable in short form.
Definition: set_var.cc:1133
#define bool
Definition: config_static.h:42
Definition: set_var.h:135
#define USERNAME_CHAR_LENGTH
Definition: mysql_com.h:61
static const int PARSE_NORMAL
Definition: set_var.h:129
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:474
bool check(THD *thd, set_var *var)
Definition: set_var.cc:346
longlong get_default()
Definition: set_var.h:187
int mysql_del_sys_var_chain(sys_var *chain)
Definition: set_var.cc:641
sys_var * Sys_gtid_next_list_ptr
virtual longlong get_min_value()
Definition: set_var.h:189
Definition: mysql_lex_string.h:39
union set_var::@91 save_result
set_var(enum_var_type type_arg, sys_var *var_arg, const LEX_STRING *base_name_arg, Item *value_arg)
Definition: set_var.cc:874
ulong get_system_variable_hash_records(void)
Definition: set_var.cc:674
ulonglong sql_mode_t
Definition: set_var.h:65
void set_user_host(THD *thd)
Definition: set_var.cc:428
const char * get_host()
Definition: set_var.h:212
int check(THD *thd)
Verify that the supplied value is correct.
Definition: set_var.cc:1031
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:430
bool is_readonly() const
Definition: set_var.h:246
ulonglong get_system_variable_hash_version(void)
Definition: set_var.cc:682
LEX_USER * user
Definition: set_var.h:445
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:903
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:383
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:390
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:1148
const char *const deprecation_substitute
Definition: set_var.h:152
Definition: set_var.h:79
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:393
Common definition used by mysys, performance schema and server & client.
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:398
Definition: set_var.h:107
virtual ulong get_var_type()
Returns variable type.
Definition: set_var.h:196
const CHARSET_INFO * character_set_results
Definition: set_var.h:465
virtual bool is_var_optimizer_trace() const
Definition: set_var.h:423
enum_variable_source get_source()
Definition: set_var.h:199
SHOW_COMP_OPTION have_dlopen
Definition: mysqld.cc:1325
bool is_struct()
the following is only true for keycache variables, that support the syntax @keycache_name.variable_name
Definition: set_var.h:261
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:2639
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:386
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:146
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:141
There can be some variables which needs to be set before plugin is loaded.
Definition: set_var.h:126
Time_zone * time_zone
for Sys_var_tz
Definition: set_var.h:396
SHOW_COMP_OPTION have_geometry
Definition: mysqld.cc:1326
Definition: set_var.h:136
int flags
or&#39;ed flag_enum values
Definition: set_var.h:144
Definition: table.h:2342
virtual bool is_var_optimizer_trace() const
Definition: set_var.h:374
bool set_user(const char *usr)
Definition: set_var.h:208
void print(const THD *thd, String *str)
To self-print.
Definition: set_var.cc:1333
virtual void set_is_plugin(bool)
Definition: set_var.h:198
A class representing one system variable - that is something that can be accessed as @global...
Definition: set_var.h:102
structure to define some default "config_option" option settings
Definition: innodb_config.h:180
Definition: set_var.h:116
virtual bool is_non_persistent()
Definition: set_var.h:226
LEX_STRING string_value
for Sys_var_charptr and others
Definition: set_var.h:397
int resolve(THD *)
Check privileges & fix_fields.
Definition: set_var.h:454
bool is_global_persist(enum_var_type type)
Definition: set_var.h:285
Definition: set_var.h:112
flag_enum
Definition: set_var.h:106
enum enum_mysql_show_type SHOW_TYPE
Definition: set_var.h:68
export sys_var * Sys_optimizer_trace_ptr
Definition: sys_vars.cc:3074
Definition: set_var.h:89
ptrdiff_t offset
offset to the value from global_system_variables
Definition: set_var.h:149
set_var_user(Item_func_set_user_var *item)
Definition: set_var.h:434
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:2637
int update(THD *thd)
Set the value.
Definition: set_var.cc:1209
virtual int light_check(THD *thd)
Used only by prepared statements to resolve and check.
Definition: set_var.h:380
Definition: set_var.h:114
virtual ulonglong get_max_value()
Definition: set_var.h:190
bool not_visible() const
Definition: set_var.h:247
SHOW_COMP_OPTION have_profiling
Definition: mysqld.cc:1328
virtual int update(THD *thd)=0
Set the value.
int scope() const
Definition: set_var.h:244
static char * path
Definition: mysqldump.cc:123
sql_mode_t expand_sql_mode(sql_mode_t sql_mode, THD *thd)
Definition: sys_vars.cc:4238
virtual ~sys_var()
Definition: set_var.h:168
bool fix_delay_key_write(sys_var *self, THD *thd, enum_var_type type)
Definition: sys_vars.cc:1834
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:862
int update(THD *thd)
Set the value.
Definition: set_var.cc:1261
bool retain_current_password
Definition: set_var.h:448
#define GET_ASK_ADDR
Definition: my_getopt.h:68
Definition: item.h:666
SHOW_COMP_OPTION have_statement_timeout
Definition: mysqld.cc:1329
virtual bool global_update(THD *thd, set_var *var)=0
unsigned int uint
Definition: uca-dump.cc:29
Definition: set_var.h:92
int light_check(THD *thd)
Check variable, but without assigning value (used by PS).
Definition: set_var.cc:1064
set_cs_flags_enum
Definition: set_var.h:469
long long int longlong
Definition: my_inttypes.h:73
void update_parser_max_mem_size()
Definition: sys_vars.cc:3004
Definition: my_getopt.h:90
bool update(THD *thd, set_var *var)
Definition: set_var.cc:286
static constexpr int HOSTNAME_LENGTH
Definition: my_hostname.h:42
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:148
Definition: set_var.h:91
int set_cs_flags
Definition: set_var.h:463
A base class for everything that can be set with SET command.
Definition: set_var.h:362
virtual sys_var_pluginvar * cast_pluginvar()
downcast for sys_var_pluginvar.
Definition: set_var.h:178
void set_source(enum_variable_source src)
Definition: set_var.h:201
Definition: m_ctype.h:359
on_update_function on_update
Definition: set_var.h:151
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:1094
Item * value
the expression that provides the new value of the variable
Definition: set_var.h:389
virtual int resolve(THD *thd)=0
Check privileges & fix_fields.
void do_deprecated_warning(THD *thd)
Definition: set_var.cc:443
unsigned long long int my_micro_time()
Return time in microseconds.
Definition: my_systime.h:182
set_var_base()
Definition: set_var.h:364
Definition: typelib.h:34
SHOW_COMP_OPTION have_query_cache
Definition: mysqld.cc:1325
SHOW_TYPE show_type()
Definition: set_var.h:243
int update(THD *thd)
Update variable.
Definition: set_var.cc:1113
virtual void cleanup()
All the cleanup procedures should be performed here.
Definition: set_var.h:173
SHOW_COMP_OPTION
Definition: sql_const.h:375
int sys_var_init()
Definition: set_var.cc:114
int resolve(THD *thd)
Check privileges & fix_fields.
Definition: set_var.cc:1173
virtual void set_arg_source(get_opt_arg_source *)
Definition: set_var.h:197
bool sql_mode_quoted_string_representation(THD *thd, sql_mode_t sql_mode, LEX_STRING *ls)
Definition: sys_vars.cc:4351
virtual bool check_update_type(Item_result type)=0
bool set_source_name(const char *path)
Definition: set_var.h:204
enum_var_type
Definition: set_var.h:87
SHOW_COMP_OPTION have_symlink
Definition: mysqld.cc:1325
char host[HOSTNAME_LENGTH+1]
Definition: set_var.h:156
int type
Definition: http_common.h:411
bool is_os_charset
true if the value is in character_set_filesystem
Definition: set_var.h:153
bool sql_mode_string_representation(THD *thd, sql_mode_t sql_mode, LEX_STRING *ls)
Definition: sys_vars.cc:4346
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:272
char user[USERNAME_CHAR_LENGTH+1]
Definition: set_var.h:155
my_option * get_option()
Definition: set_var.h:218
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:696
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:1303
Definition: my_getopt.h:80
virtual const uchar * global_value_ptr(THD *thd, LEX_STRING *base)
Definition: set_var.cc:334
Definition: set_var.h:88
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:113
sys_var * next
Definition: set_var.h:104
void lock_plugin_mutex()
Definition: sql_plugin.cc:2635
static bool set_and_truncate(char *dst, const char *string, size_t sizeof_dst)
Definition: set_var.h:313
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:1293
virtual bool session_update(THD *thd, set_var *var)=0
const uchar * value_ptr(THD *running_thd, THD *target_thd, enum_var_type type, LEX_STRING *base)
Definition: set_var.cc:368
sys_var * var
system variable to be updated
Definition: set_var.h:388
bool is_hint_updateable() const
Check if the variable can be set using SET_VAR hint.
Definition: set_var.h:256
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:365
ulonglong get_timestamp() const
Definition: set_var.h:216
plugin_ref plugin
for Sys_var_plugin
Definition: set_var.h:395
SHOW_COMP_OPTION have_compress
Definition: mysqld.cc:1327
A better implementation of the UNIX ctype(3) library.
my_option option
min, max, default values are stored here
Definition: set_var.h:147
char * current_password
Definition: set_var.h:447
bool is_persist_readonly() const
Definition: set_var.h:249
void save_default(THD *thd, set_var *var)
Definition: set_var.h:310
void clear_user_host_timestamp()
Definition: set_var.h:221
enum enum_variable_source m_source
Definition: my_getopt.h:85
const char * get_source_name()
Definition: set_var.h:200
#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:146
static const char * sql_mode
Definition: mysqlslap.cc:189
int resolve(THD *)
Check privileges & fix_fields.
Definition: set_var.h:482
Definition: item_func.h:2992
sys_var * Sys_autocommit_ptr
Definition: sys_vars.cc:4817
set_var_password(LEX_USER *user_arg, char *password_arg, char *current_password_arg, bool retain_current)
Definition: set_var.cc:1230
int resolve(THD *thd)
Resolve the variable assignment
Definition: set_var.cc:974
const CHARSET_INFO * get_old_charset_by_name(const char *old_name)
Definition: set_var.cc:578
bool register_option(std::vector< my_option > *array, int parse_flags)
Definition: set_var.h:295
ulonglong system_variable_hash_version
Definition: set_var.cc:76
bool set_host(const char *hst)
Definition: set_var.h:213
unsigned long ulong
Definition: my_inttypes.h:48
double double_value
for Sys_var_double
Definition: set_var.h:394
struct get_opt_arg_source source
Definition: set_var.h:154
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:401
virtual bool do_check(THD *thd, set_var *var)=0
sys_var * Sys_gtid_purged_ptr
Definition: sys_vars.cc:6034
bool is_written_to_binlog(enum_var_type type)
Definition: set_var.h:262
enum enum_mysql_show_scope SHOW_SCOPE
Definition: set_var.h:69
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:134
static const int PARSE_EARLY
Definition: set_var.h:128
bool is_settable_at_command_line()
Return true if settable at the command line.
Definition: set_var.h:293
bool(* on_check_function)(sys_var *self, THD *thd, set_var *var)
Definition: set_var.h:140
#define comment
Definition: lexyy.cc:959
sys_var * find_sys_var(THD *thd, const char *str, size_t length=0)
Definition: sql_plugin.cc:2668
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:777
int check(THD *thd)
Evaluate the expression.
Definition: set_var.cc:1181
void print(const THD *thd, String *str)
To self-print.
Definition: set_var.cc:1222
void set_timestamp()
Definition: set_var.h:219
Item_func_set_user_var * user_var_item
Definition: set_var.h:431
Definition: set_var.h:90
sys_var * first
Definition: set_var.h:80
const char * get_user()
Definition: set_var.h:211