MySQL  8.0.17
Source Code Documentation
sys_vars.h
Go to the documentation of this file.
1 #ifndef SYS_VARS_H_INCLUDED
2 #define SYS_VARS_H_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  "private" interface to sys_var - server configuration variables.
28 
29  This header is included only by the file that contains declarations
30  of sys_var variables (sys_vars.cc).
31 */
32 
33 #include "my_config.h"
34 
35 #include <stddef.h>
36 #include <stdlib.h>
37 #include <string.h>
38 #include <sys/types.h>
39 
40 #include "keycache.h" // dflt_key_cache
41 #include "lex_string.h"
42 #include "m_ctype.h"
43 #include "my_base.h"
44 #include "my_bit.h" // my_count_bits
45 #include "my_compiler.h"
46 #include "my_dbug.h"
47 #include "my_getopt.h"
48 #include "my_inttypes.h"
49 #include "my_sys.h"
50 #include "mysql/plugin.h"
52 #include "mysql/status_var.h"
54 #include "mysqld_error.h"
56 #include "sql/debug_sync.h" // debug_sync_update
57 #include "sql/handler.h"
58 #include "sql/item.h" // Item
59 #include "sql/keycaches.h" // default_key_cache_base
60 #include "sql/mysqld.h" // max_system_variables
61 #include "sql/rpl_gtid.h"
62 #include "sql/set_var.h" // sys_var_chain
63 #include "sql/sql_class.h" // THD
64 #include "sql/sql_connect.h"
65 #include "sql/sql_const.h"
66 #include "sql/sql_error.h"
67 #include "sql/sql_plugin.h" // my_plugin_lock_by_name
68 #include "sql/sql_plugin_ref.h"
69 #include "sql/strfunc.h" // find_type
71 #include "sql/sys_vars_shared.h" // throw_bounds_warning
72 #include "sql/tztime.h" // Time_zone
73 #include "sql_string.h"
74 #include "typelib.h"
75 
76 class Sys_var_bit;
77 class Sys_var_bool;
78 class Sys_var_charptr;
79 class Sys_var_double;
81 class Sys_var_enum;
82 class Sys_var_flagset;
83 class Sys_var_gtid_mode;
84 class Sys_var_have;
85 class Sys_var_lexstring;
86 class Sys_var_multi_enum;
87 class Sys_var_plugin;
88 class Sys_var_set;
89 class Sys_var_tz;
90 struct CMD_LINE;
91 struct System_variables;
92 template <typename Struct_type, typename Name_getter>
94 template <typename T, ulong ARGT, enum enum_mysql_show_type SHOWT, bool SIGNED>
96 
97 /*
98  a set of mostly trivial (as in f(X)=X) defines below to make system variable
99  declarations more readable
100 */
101 #define VALID_RANGE(X, Y) X, Y
102 #define DEFAULT(X) X
103 #define BLOCK_SIZE(X) X
104 #define GLOBAL_VAR(X) \
105  sys_var::GLOBAL, (((char *)&(X)) - (char *)&global_system_variables), \
106  sizeof(X)
107 #define SESSION_VAR(X) \
108  sys_var::SESSION, offsetof(System_variables, X), \
109  sizeof(((System_variables *)0)->X)
110 #define SESSION_ONLY(X) \
111  sys_var::ONLY_SESSION, offsetof(System_variables, X), \
112  sizeof(((System_variables *)0)->X)
113 #define NO_CMD_LINE CMD_LINE(NO_ARG, -1)
114 /*
115  the define below means that there's no *second* mutex guard,
116  LOCK_global_system_variables always guards all system variables
117 */
118 #define NO_MUTEX_GUARD ((PolyLock *)0)
119 #define IN_BINLOG sys_var::SESSION_VARIABLE_IN_BINLOG
120 #define NOT_IN_BINLOG sys_var::VARIABLE_NOT_IN_BINLOG
121 #define ON_READ(X) X
122 #define ON_CHECK(X) X
123 #define ON_UPDATE(X) X
124 #define READ_ONLY sys_var::READONLY +
125 #define NOT_VISIBLE sys_var::INVISIBLE +
126 #define UNTRACKED_DEFAULT sys_var::TRI_LEVEL +
127 #define HINT_UPDATEABLE sys_var::HINT_UPDATEABLE +
128 // this means that Sys_var_charptr initial value was malloc()ed
129 #define PREALLOCATED sys_var::ALLOCATED +
130 #define NON_PERSIST sys_var::NOTPERSIST +
131 #define PERSIST_AS_READONLY sys_var::PERSIST_AS_READ_ONLY +
132 
133 /*
134  Sys_var_bit meaning is reversed, like in
135  @@foreign_key_checks <-> OPTION_NO_FOREIGN_KEY_CHECKS
136 */
137 #define REVERSE(X) ~(X)
138 #define DEPRECATED_VAR(X) X
139 
140 #define session_var(THD, TYPE) (*(TYPE *)session_var_ptr(THD))
141 #define global_var(TYPE) (*(TYPE *)global_var_ptr())
142 
143 #if SIZEOF_OFF_T > 4
144 #define GET_HA_ROWS GET_ULL
145 #else
146 #define GET_HA_ROWS GET_ULONG
147 #endif
148 
150 
152 
153 static const char *bool_values[3] = {"OFF", "ON", 0};
154 
155 const char *fixup_enforce_gtid_consistency_command_line(char *value_arg);
156 
157 /**
158  A small wrapper class to pass getopt arguments as a pair
159  to the Sys_var_* constructors. It improves type safety and helps
160  to catch errors in the argument order.
161 */
162 struct CMD_LINE {
163  int id;
165  CMD_LINE(enum get_opt_arg_type getopt_arg_type, int getopt_id = 0)
166  : id(getopt_id), arg_type(getopt_arg_type) {}
167 };
168 
169 /**
170  Sys_var_integer template is used to generate Sys_var_* classes
171  for variables that represent the value as a signed or unsigned integer.
172  They are Sys_var_uint, Sys_var_ulong, Sys_var_harows, Sys_var_ulonglong,
173  and Sys_var_long.
174 
175  An integer variable has a minimal and maximal values, and a "block_size"
176  (any valid value of the variable must be divisible by the block_size).
177 
178  Class specific constructor arguments: min, max, block_size
179  Backing store: uint, ulong, ha_rows, ulonglong, long, depending on the
180  Sys_var_*
181 */
182 template <typename T, ulong ARGT, enum enum_mysql_show_type SHOWT, bool SIGNED>
183 class Sys_var_integer : public sys_var {
184  public : Sys_var_integer(
185  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
186  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, T min_val, T max_val,
187  T def_val, uint block_size, PolyLock *lock = 0,
188  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
189  on_check_function on_check_func = 0,
190  on_update_function on_update_func = 0, const char *substitute = 0,
191  int parse_flag = PARSE_NORMAL) :
192  sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
193  getopt.arg_type, SHOWT, def_val, lock, binlog_status_arg,
194  on_check_func, on_update_func, substitute, parse_flag){
195  option.var_type = ARGT; option.min_value = min_val;
196  option.max_value = max_val; option.block_size = block_size;
197  option.u_max_value = (uchar **)max_var_ptr();
198  if (max_var_ptr()) * max_var_ptr() = max_val;
199 
200  // Do not set global_var for Sys_var_keycache objects
201  if (offset >= 0) global_var(T) = def_val;
202 
203  DBUG_ASSERT(size == sizeof(T)); DBUG_ASSERT(min_val < max_val);
204  DBUG_ASSERT(min_val <= def_val); DBUG_ASSERT(max_val >= def_val);
205  DBUG_ASSERT(block_size > 0); DBUG_ASSERT(def_val % block_size == 0);}
206 bool do_check(THD *thd, set_var *var) {
207  bool fixed = false;
208  longlong v;
209  ulonglong uv;
210 
211  v = var->value->val_int();
212  if (SIGNED) /* target variable has signed type */
213  {
214  if (var->value->unsigned_flag) {
215  /*
216  Input value is such a large positive number that MySQL used an
217  unsigned item to hold it. When cast to a signed longlong, if the
218  result is negative there is "cycling" and this is incorrect (large
219  positive input value should not end up as a large negative value in
220  the session signed variable to be set); instead, we need to pick the
221  allowed number closest to the positive input value, i.e. pick the
222  biggest allowed positive integer.
223  */
224  if (v < 0)
225  uv = max_of_int_range(ARGT);
226  else /* no cycling, longlong can hold true value */
227  uv = (ulonglong)v;
228  } else
229  uv = v;
230  /* This will further restrict with VALID_RANGE, BLOCK_SIZE */
232  getopt_ll_limit_value(uv, &option, &fixed);
233  } else {
234  if (var->value->unsigned_flag) {
235  /* Guaranteed positive input value, ulonglong can hold it */
236  uv = (ulonglong)v;
237  } else {
238  /*
239  Maybe negative input value; in this case, cast to ulonglong makes it
240  positive, which is wrong. Pick the closest allowed value i.e. 0.
241  */
242  uv = (ulonglong)(v < 0 ? 0 : v);
243  }
245  getopt_ull_limit_value(uv, &option, &fixed);
246  }
247 
248  if (max_var_ptr()) {
249  /* check constraint set with --maximum-...=X */
250  if (SIGNED) {
251  longlong max_val = *max_var_ptr();
252  if (((longlong)(var->save_result.ulonglong_value)) > max_val)
253  var->save_result.ulonglong_value = max_val;
254  /*
255  Signed variable probably has some kind of symmetry. Then it's good
256  to limit negative values just as we limit positive values.
257  */
258  max_val = -max_val;
259  if (((longlong)(var->save_result.ulonglong_value)) < max_val)
260  var->save_result.ulonglong_value = max_val;
261  } else {
262  ulonglong max_val = *max_var_ptr();
263  if (var->save_result.ulonglong_value > max_val)
264  var->save_result.ulonglong_value = max_val;
265  }
266  }
267 
268  return throw_bounds_warning(thd, name.str,
270  var->value->unsigned_flag, v);
271 }
272 bool session_update(THD *thd, set_var *var) {
273  session_var(thd, T) = static_cast<T>(var->save_result.ulonglong_value);
274  return false;
275 }
276 bool global_update(THD *, set_var *var) {
277  global_var(T) = static_cast<T>(var->save_result.ulonglong_value);
278  return false;
279 }
281 void session_save_default(THD *thd, set_var *var) {
282  var->save_result.ulonglong_value = static_cast<ulonglong>(
283  *pointer_cast<const T *>(global_value_ptr(thd, nullptr)));
284 }
286  var->save_result.ulonglong_value = option.def_value;
287 }
288 void saved_value_to_string(THD *, set_var *var, char *def_val) {
289  if (SIGNED)
291  else
293 }
294 
295 private:
297  return scope() == SESSION ? (T *)(((uchar *)&max_system_variables) + offset)
298  : 0;
299 }
300 }
301 ;
302 
311 
312 /**
313  Helper class for variables that take values from a TYPELIB
314 */
315 class Sys_var_typelib : public sys_var {
316  protected:
318 
319  public:
320  Sys_var_typelib(const char *name_arg, const char *comment, int flag_args,
321  ptrdiff_t off, CMD_LINE getopt, SHOW_TYPE show_val_type_arg,
322  const char *values[], ulonglong def_val, PolyLock *lock,
323  enum binlog_status_enum binlog_status_arg,
324  on_check_function on_check_func,
325  on_update_function on_update_func, const char *substitute,
326  int parse_flag = PARSE_NORMAL)
327  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
328  getopt.arg_type, show_val_type_arg, def_val, lock,
329  binlog_status_arg, on_check_func, on_update_func, substitute,
330  parse_flag) {
331  for (typelib.count = 0; values[typelib.count]; typelib.count++) /*no-op */
332  ;
333  typelib.name = "";
334  typelib.type_names = values;
335  typelib.type_lengths = 0; // only used by Fields_enum and Field_set
336  option.typelib = &typelib;
337  }
338  bool do_check(THD *, set_var *var) // works for enums and bool
339  {
340  char buff[STRING_BUFFER_USUAL_SIZE];
341  String str(buff, sizeof(buff), system_charset_info), *res;
342 
343  if (var->value->result_type() == STRING_RESULT) {
344  if (!(res = var->value->val_str(&str)))
345  return true;
346  else if (!(var->save_result.ulonglong_value =
347  find_type(&typelib, res->ptr(), res->length(), false)))
348  return true;
349  else
351  } else {
352  longlong tmp = var->value->val_int();
353  if (tmp < 0 || tmp >= static_cast<longlong>(typelib.count))
354  return true;
355  else
356  var->save_result.ulonglong_value = tmp;
357  }
358 
359  return false;
360  }
362  return type != INT_RESULT && type != STRING_RESULT;
363  }
364 };
365 
366 /**
367  The class for ENUM variables - variables that take one value from a fixed
368  list of values.
369 
370  Class specific constructor arguments:
371  char* values[] - 0-terminated list of strings of valid values
372 
373  Backing store: uint
374 
375  @note
376  Do *not* use "enum FOO" variables as a backing store, there is no
377  guarantee that sizeof(enum FOO) == sizeof(uint), there is no guarantee
378  even that sizeof(enum FOO) == sizeof(enum BAR)
379 */
381  public:
383  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
384  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, const char *values[],
385  uint def_val, PolyLock *lock = 0,
386  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
387  on_check_function on_check_func = 0,
388  on_update_function on_update_func = 0, const char *substitute = 0)
389  : Sys_var_typelib(name_arg, comment, flag_args, off, getopt, SHOW_CHAR,
390  values, def_val, lock, binlog_status_arg, on_check_func,
391  on_update_func, substitute) {
392  option.var_type = GET_ENUM;
393  global_var(ulong) = def_val;
394  DBUG_ASSERT(def_val < typelib.count);
395  DBUG_ASSERT(size == sizeof(ulong));
396  }
397  bool session_update(THD *thd, set_var *var) {
398  session_var(thd, ulong) =
399  static_cast<ulong>(var->save_result.ulonglong_value);
400  return false;
401  }
402  bool global_update(THD *, set_var *var) {
403  global_var(ulong) = static_cast<ulong>(var->save_result.ulonglong_value);
404  return false;
405  }
408  }
410  var->save_result.ulonglong_value = option.def_value;
411  }
412  void saved_value_to_string(THD *, set_var *var, char *def_val) {
414  }
415  const uchar *session_value_ptr(THD *, THD *target_thd, LEX_STRING *) {
416  return pointer_cast<const uchar *>(
417  typelib.type_names[session_var(target_thd, ulong)]);
418  }
421  }
422 };
423 
424 /**
425  The class for boolean variables - a variant of ENUM variables
426  with the fixed list of values of { OFF , ON }
427 
428  Backing store: bool
429 */
431  public:
433  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
434  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, bool def_val,
435  PolyLock *lock = 0,
436  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
437  on_check_function on_check_func = 0,
438  on_update_function on_update_func = 0, const char *substitute = 0,
439  int parse_flag = PARSE_NORMAL)
440  : Sys_var_typelib(name_arg, comment, flag_args, off, getopt, SHOW_MY_BOOL,
441  bool_values, def_val, lock, binlog_status_arg,
442  on_check_func, on_update_func, substitute, parse_flag) {
443  option.var_type = GET_BOOL;
444  global_var(bool) = def_val;
445  DBUG_ASSERT(getopt.arg_type == OPT_ARG || getopt.id == -1);
446  DBUG_ASSERT(size == sizeof(bool));
447  }
448  bool session_update(THD *thd, set_var *var) {
449  session_var(thd, bool) =
450  static_cast<bool>(var->save_result.ulonglong_value);
451  return false;
452  }
453  bool global_update(THD *, set_var *var) {
454  global_var(bool) = static_cast<bool>(var->save_result.ulonglong_value);
455  return false;
456  }
457  void session_save_default(THD *thd, set_var *var) {
458  var->save_result.ulonglong_value = static_cast<ulonglong>(
459  *pointer_cast<const bool *>(global_value_ptr(thd, nullptr)));
460  }
462  var->save_result.ulonglong_value = option.def_value;
463  }
464  void saved_value_to_string(THD *, set_var *var, char *def_val) {
466  }
467 };
468 
469 /**
470  A variant of enum where:
471  - Each value may have multiple enum-like aliases.
472  - Instances of the class can specify different default values for
473  the cases:
474  - User specifies the command-line option without a value (i.e.,
475  --option, not --option=value).
476  - User does not specify a command-line option at all.
477 
478  This exists mainly to allow extending a variable that once was
479  boolean in a GA version, into an enumeration type. Booleans accept
480  multiple aliases (0=off=false, 1=on=true), but Sys_var_enum does
481  not, so we could not use Sys_var_enum without breaking backward
482  compatibility. Moreover, booleans default to false if option is not
483  given, and true if option is given without value.
484 
485  This is *incompatible* with boolean in the following sense:
486  'SELECT @@variable' returns 0 or 1 for a boolean, whereas this class
487  (similar to enum) returns the textual form. (Note that both boolean,
488  enum, and this class return the textual form in SHOW VARIABLES and
489  SELECT * FROM information_schema.variables).
490 
491  See enforce_gtid_consistency for an example of how this can be used.
492 */
493 class Sys_var_multi_enum : public sys_var {
494  public:
495  struct ALIAS {
496  const char *alias;
498  };
499 
500  /**
501  Enumerated type system variable.
502 
503  @param name_arg See sys_var::sys_var()
504 
505  @param comment See sys_var::sys_var()
506 
507  @param flag_args See sys_var::sys_var()
508 
509  @param off See sys_var::sys_var()
510 
511  @param size See sys_var::sys_var()
512 
513  @param getopt See sys_var::sys_var()
514 
515  @param aliases_arg Array of ALIASes, indicating which textual
516  values map to which number. Should be terminated with an ALIAS
517  having member variable alias set to NULL. The first
518  `value_count_arg' elements must map to 0, 1, etc; these will be
519  used when the value is displayed. Remaining elements may appear
520  in arbitrary order.
521 
522  @param value_count_arg The number of allowed integer values.
523 
524  @param def_val The default value if no command line option is
525  given. This must be a valid index into the aliases_arg array, but
526  it does not have to be less than value_count. The corresponding
527  alias will be used in mysqld --help to show the default value.
528 
529  @param command_line_no_value_arg The default value if a command line
530  option is given without a value ('--command-line-option' without
531  '=VALUE'). This must be less than value_count_arg.
532 
533  @param lock See sys_var::sys_var()
534 
535  @param binlog_status_arg See sys_var::sys_var()
536 
537  @param on_check_func See sys_var::sys_var()
538 
539  @param on_update_func See sys_var::sys_var()
540 
541  @param substitute See sys_var::sys_var()
542 
543  @param parse_flag See sys_var::sys_var()
544  */
546  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
547  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt,
548  const ALIAS aliases_arg[], uint value_count_arg, uint def_val,
549  uint command_line_no_value_arg, PolyLock *lock = 0,
550  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
551  on_check_function on_check_func = 0,
552  on_update_function on_update_func = 0, const char *substitute = 0,
553  int parse_flag = PARSE_NORMAL)
554  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
555  getopt.arg_type, SHOW_CHAR, def_val, lock, binlog_status_arg,
556  on_check_func, on_update_func, substitute, parse_flag),
557  value_count(value_count_arg),
558  aliases(aliases_arg),
559  command_line_no_value(command_line_no_value_arg) {
562  DBUG_ASSERT(def_val < alias_count);
563 
564  option.var_type = GET_STR;
565  option.value = &command_line_value;
566  option.def_value = (intptr)aliases[def_val].alias;
567 
568  global_var(ulong) = aliases[def_val].number;
569 
570  DBUG_ASSERT(getopt.arg_type == OPT_ARG || getopt.id == -1);
571  DBUG_ASSERT(size == sizeof(ulong));
572  }
573 
574  /**
575  Return the numeric value for a given alias string, or -1 if the
576  string is not a valid alias.
577  */
578  int find_value(const char *text) {
579  for (uint i = 0; aliases[i].alias != NULL; i++)
580  if (my_strcasecmp(system_charset_info, aliases[i].alias, text) == 0)
581  return aliases[i].number;
582  return -1;
583  }
584 
585  /**
586  Because of limitations in the command-line parsing library, the
587  value given on the command-line cannot be automatically copied to
588  the global value. Instead, inheritants of this class should call
589  this function from mysqld.cc:mysqld_get_one_option.
590 
591  @param value_str Pointer to the value specified on the command
592  line (as in --option=VALUE).
593 
594  @retval NULL Success.
595 
596  @retval non-NULL Pointer to the invalid string that was used as
597  argument.
598  */
599  const char *fixup_command_line(const char *value_str) {
600  DBUG_ENTER("Sys_var_multi_enum::fixup_command_line");
601  char *end = NULL;
602  long value;
603 
604  // User passed --option (not --option=value).
605  if (value_str == NULL) {
607  goto end;
608  }
609 
610  // Get textual value.
611  value = find_value(value_str);
612  if (value != -1) goto end;
613 
614  // Get numeric value.
615  value = strtol(value_str, &end, 10);
616  // found a number and nothing else?
617  if (end > value_str && *end == '\0')
618  // value is in range?
619  if (value >= 0 && (longlong)value < (longlong)value_count) goto end;
620 
621  // Not a valid value.
622  DBUG_RETURN(value_str);
623 
624  end:
626  DBUG_RETURN(NULL);
627  }
628 
629  bool do_check(THD *, set_var *var) {
630  DBUG_ENTER("Sys_var_multi_enum::do_check");
631  char buff[STRING_BUFFER_USUAL_SIZE];
632  String str(buff, sizeof(buff), system_charset_info), *res;
633  if (var->value->result_type() == STRING_RESULT) {
634  res = var->value->val_str(&str);
635  if (!res) DBUG_RETURN(true);
636 
637  /* Check if the value is a valid string. */
638  size_t valid_len;
639  bool len_error;
640  if (validate_string(system_charset_info, res->ptr(), res->length(),
641  &valid_len, &len_error))
642  DBUG_RETURN(true);
643 
644  int value = find_value(res->ptr());
645  if (value == -1) DBUG_RETURN(true);
647  } else {
648  longlong value = var->value->val_int();
649  if (value < 0 || value >= (longlong)value_count)
650  DBUG_RETURN(true);
651  else
653  }
654 
655  DBUG_RETURN(false);
656  }
658  return type != INT_RESULT && type != STRING_RESULT;
659  }
661  DBUG_ENTER("Sys_var_multi_enum::session_update");
662  DBUG_ASSERT(0);
663  /*
664  Currently not used: uncomment if this class is used as a base for
665  a session variable.
666 
667  session_var(thd, ulong)=
668  static_cast<ulong>(var->save_result.ulonglong_value);
669  */
670  DBUG_RETURN(false);
671  }
672  bool global_update(THD *, set_var *) {
673  DBUG_ENTER("Sys_var_multi_enum::global_update");
674  DBUG_ASSERT(0);
675  /*
676  Currently not used: uncomment if this some inheriting class does
677  not override..
678 
679  ulong val=
680  static_cast<ulong>(var->save_result.ulonglong_value);
681  global_var(ulong)= val;
682  */
683  DBUG_RETURN(false);
684  }
686  DBUG_ENTER("Sys_var_multi_enum::session_save_default");
687  DBUG_ASSERT(0);
688  /*
689  Currently not used: uncomment if this class is used as a base for
690  a session variable.
691 
692  int value= find_value((char *)option.def_value);
693  DBUG_ASSERT(value != -1);
694  var->save_result.ulonglong_value= value;
695  */
697  }
699  DBUG_ENTER("Sys_var_multi_enum::global_save_default");
700  int value = find_value((char *)option.def_value);
701  DBUG_ASSERT(value != -1);
704  }
705  void saved_value_to_string(THD *, set_var *var, char *def_val) {
707  }
708 
710  DBUG_ENTER("Sys_var_multi_enum::session_value_ptr");
711  DBUG_ASSERT(0);
712  /*
713  Currently not used: uncomment if this class is used as a base for
714  a session variable.
715 
716  DBUG_RETURN((uchar*)aliases[session_var(target_thd, ulong)].alias);
717  */
718  DBUG_RETURN(0);
719  }
721  DBUG_ENTER("Sys_var_multi_enum::global_value_ptr");
722  DBUG_RETURN(pointer_cast<const uchar *>(aliases[global_var(ulong)].alias));
723  }
724 
725  private:
726  /// The number of allowed numeric values.
728  /// Array of all textual aliases.
729  const ALIAS *aliases;
730  /// The number of elements of aliases (computed in the constructor).
732 
733  /**
734  Pointer to the value set by the command line (set by the command
735  line parser, copied to the global value in fixup_command_line()).
736  */
737  const char *command_line_value;
739 };
740 
741 /**
742  The class for string variables. The string can be in character_set_filesystem
743  or in character_set_system. The string can be allocated with my_malloc()
744  or not. The state of the initial value is specified in the constructor,
745  after that it's managed automatically. The value of NULL is supported.
746 
747  Class specific constructor arguments:
748  enum charset_enum is_os_charset_arg
749 
750  Backing store: char*
751 
752 */
753 class Sys_var_charptr : public sys_var {
754  public:
756  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
757  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt,
758  enum charset_enum is_os_charset_arg, const char *def_val,
759  PolyLock *lock = 0,
760  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
761  on_check_function on_check_func = 0,
762  on_update_function on_update_func = 0, const char *substitute = 0,
763  int parse_flag = PARSE_NORMAL)
764  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
765  getopt.arg_type, SHOW_CHAR_PTR, (intptr)def_val, lock,
766  binlog_status_arg, on_check_func, on_update_func, substitute,
767  parse_flag) {
768  is_os_charset = is_os_charset_arg == IN_FS_CHARSET;
769  option.var_type = (flags & ALLOCATED) ? GET_STR_ALLOC : GET_STR;
770  global_var(const char *) = def_val;
771  DBUG_ASSERT(size == sizeof(char *));
772  }
773 
774  void cleanup() {
775  if (flags & ALLOCATED) my_free(global_var(char *));
776  flags &= ~ALLOCATED;
777  }
778 
779  bool do_check(THD *thd, set_var *var) {
781  String str(buff, sizeof(buff), charset(thd));
782  String str2(buff2, sizeof(buff2), charset(thd)), *res;
783 
784  if (!(res = var->value->val_str(&str)))
785  var->save_result.string_value.str = 0;
786  else {
787  size_t unused;
788  if (String::needs_conversion(res->length(), res->charset(), charset(thd),
789  &unused)) {
790  uint errors;
791  str2.copy(res->ptr(), res->length(), res->charset(), charset(thd),
792  &errors);
793  res = &str2;
794  }
796  thd->strmake(res->ptr(), res->length());
797  var->save_result.string_value.length = res->length();
798  }
799 
800  return false;
801  }
802 
803  bool session_update(THD *thd, set_var *var) {
804  char *new_val = var->save_result.string_value.str;
805  size_t new_val_len = var->save_result.string_value.length;
806  char *ptr = ((char *)&thd->variables + offset);
807 
808  return thd->session_sysvar_res_mgr.update((char **)ptr, new_val,
809  new_val_len);
810  }
811 
812  bool global_update(THD *thd, set_var *var);
813 
815  char *ptr = (char *)(intptr)option.def_value;
816  var->save_result.string_value.str = ptr;
817  var->save_result.string_value.length = ptr ? strlen(ptr) : 0;
818  }
819 
821  char *ptr = (char *)(intptr)option.def_value;
822  /*
823  TODO: default values should not be null. Fix all and turn this into an
824  assert.
825  Do that only for NON_PERSIST READ_ONLY variables since the rest use
826  the NULL value as a flag that SET .. = DEFAULT was issued and hence
827  it should not be alterned.
828  */
832  ? ptr
833  : const_cast<char *>("");
834  var->save_result.string_value.length = ptr ? strlen(ptr) : 0;
835  }
836  void saved_value_to_string(THD *, set_var *var, char *def_val) {
837  memcpy(def_val, var->save_result.string_value.str,
839  }
841 };
842 
844  public:
845  Sys_var_version(const char *name_arg, const char *comment, int flag_args,
846  ptrdiff_t off, size_t size, CMD_LINE getopt,
847  enum charset_enum is_os_charset_arg, const char *def_val)
848  : Sys_var_charptr(name_arg, comment, flag_args, off, size, getopt,
849  is_os_charset_arg, def_val) {}
850 
852 
853  virtual const uchar *global_value_ptr(THD *thd, LEX_STRING *base) {
854  const uchar *value = Sys_var_charptr::global_value_ptr(thd, base);
855 
856  DBUG_EXECUTE_IF("alter_server_version_str", {
857  static const char *altered_value = "some-other-version";
858  const uchar *altered_value_ptr = pointer_cast<uchar *>(&altered_value);
859  value = altered_value_ptr;
860  });
861 
862  return value;
863  }
864 };
865 
866 class Sys_var_proxy_user : public sys_var {
867  public:
868  Sys_var_proxy_user(const char *name_arg, const char *comment,
869  enum charset_enum is_os_charset_arg)
870  : sys_var(&all_sys_vars, name_arg, comment,
873  PARSE_NORMAL) {
874  is_os_charset = is_os_charset_arg == IN_FS_CHARSET;
875  option.var_type = GET_STR;
876  }
877  bool do_check(THD *, set_var *) {
878  DBUG_ASSERT(false);
879  return true;
880  }
882  DBUG_ASSERT(false);
883  return true;
884  }
885  bool global_update(THD *, set_var *) {
886  DBUG_ASSERT(false);
887  return false;
888  }
891  void saved_value_to_string(THD *, set_var *, char *) { DBUG_ASSERT(false); }
892  bool check_update_type(Item_result) { return true; }
893 
894  protected:
895  virtual const uchar *session_value_ptr(THD *, THD *target_thd, LEX_STRING *) {
896  const char *proxy_user = target_thd->security_context()->proxy_user().str;
897  return proxy_user[0] ? pointer_cast<const uchar *>(proxy_user) : nullptr;
898  }
899 };
900 
902  public:
903  Sys_var_external_user(const char *name_arg, const char *comment_arg,
904  enum charset_enum is_os_charset_arg)
905  : Sys_var_proxy_user(name_arg, comment_arg, is_os_charset_arg) {}
906 
907  protected:
908  virtual const uchar *session_value_ptr(THD *, THD *target_thd, LEX_STRING *) {
909  LEX_CSTRING external_user = target_thd->security_context()->external_user();
910  return external_user.length ? pointer_cast<const uchar *>(external_user.str)
911  : nullptr;
912  }
913 };
914 
915 /**
916  The class for string variables. Useful for strings that aren't necessarily
917  \0-terminated. Otherwise the same as Sys_var_charptr.
918 
919  Class specific constructor arguments:
920  enum charset_enum is_os_charset_arg
921 
922  Backing store: LEX_STRING
923 
924  @note
925  Behaves exactly as Sys_var_charptr, only the backing store is different.
926 */
928  public:
930  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
931  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt,
932  enum charset_enum is_os_charset_arg, const char *def_val,
933  PolyLock *lock = 0,
934  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
935  on_check_function on_check_func = 0,
936  on_update_function on_update_func = 0, const char *substitute = 0)
937  : Sys_var_charptr(name_arg, comment, flag_args, off, sizeof(char *),
938  getopt, is_os_charset_arg, def_val, lock,
939  binlog_status_arg, on_check_func, on_update_func,
940  substitute) {
941  global_var(LEX_STRING).length = strlen(def_val);
942  DBUG_ASSERT(size == sizeof(LEX_STRING));
943  *const_cast<SHOW_TYPE *>(&show_val_type) = SHOW_LEX_STRING;
944  }
945  bool global_update(THD *thd, set_var *var) {
946  if (Sys_var_charptr::global_update(thd, var)) return true;
948  return false;
949  }
950 };
951 
952 #ifndef DBUG_OFF
953 /**
954  @@session.dbug and @@global.dbug variables.
955 
956  @@dbug variable differs from other variables in one aspect:
957  if its value is not assigned in the session, it "points" to the global
958  value, and so when the global value is changed, the change
959  immediately takes effect in the session.
960 
961  This semantics is intentional, to be able to debug one session from
962  another.
963 */
964 class Sys_var_dbug : public sys_var {
965  public:
967  const char *name_arg, const char *comment, int flag_args, CMD_LINE getopt,
968  const char *def_val, PolyLock *lock = 0,
969  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
970  on_check_function on_check_func = 0,
971  on_update_function on_update_func = 0, const char *substitute = 0,
972  int parse_flag = PARSE_NORMAL)
973  : sys_var(&all_sys_vars, name_arg, comment, flag_args, 0, getopt.id,
974  getopt.arg_type, SHOW_CHAR, (intptr)def_val, lock,
975  binlog_status_arg, on_check_func, on_update_func, substitute,
976  parse_flag) {
977  option.var_type = GET_NO_ARG;
978  }
979  bool do_check(THD *thd, set_var *var) {
980  char buff[STRING_BUFFER_USUAL_SIZE];
981  String str(buff, sizeof(buff), system_charset_info), *res;
982 
983  if (!(res = var->value->val_str(&str)))
984  var->save_result.string_value.str = const_cast<char *>("");
985  else
987  thd->strmake(res->ptr(), res->length());
988  return false;
989  }
990  bool session_update(THD *, set_var *var) {
991  const char *val = var->save_result.string_value.str;
992  if (!var->value)
993  DBUG_POP();
994  else
995  DBUG_SET(val);
996  return false;
997  }
998  bool global_update(THD *, set_var *var) {
999  const char *val = var->save_result.string_value.str;
1000  DBUG_SET_INITIAL(val);
1001  return false;
1002  }
1005  char *ptr = (char *)(intptr)option.def_value;
1006  var->save_result.string_value.str = ptr;
1007  }
1008  void saved_value_to_string(THD *, set_var *var, char *def_val) {
1009  memcpy(def_val, var->save_result.string_value.str,
1011  }
1012  const uchar *session_value_ptr(THD *running_thd, THD *, LEX_STRING *) {
1013  char buf[256];
1014  DBUG_EXPLAIN(buf, sizeof(buf));
1015  return (uchar *)running_thd->mem_strdup(buf);
1016  }
1018  char buf[256];
1019  DBUG_EXPLAIN_INITIAL(buf, sizeof(buf));
1020  return (uchar *)thd->mem_strdup(buf);
1021  }
1023 };
1024 #endif
1025 
1026 #define KEYCACHE_VAR(X) \
1027  sys_var::GLOBAL, offsetof(KEY_CACHE, X), sizeof(((KEY_CACHE *)0)->X)
1028 #define keycache_var_ptr(KC, OFF) (((uchar *)(KC)) + (OFF))
1029 #define keycache_var(KC, OFF) (*(ulonglong *)keycache_var_ptr(KC, OFF))
1030 typedef bool (*keycache_update_function)(THD *, KEY_CACHE *, ptrdiff_t,
1031  ulonglong);
1032 
1033 /**
1034  The class for keycache_* variables. Supports structured names,
1035  keycache_name.variable_name.
1036 
1037  Class specific constructor arguments:
1038  everything derived from Sys_var_ulonglong
1039 
1040  Backing store: ulonglong
1041 
1042  @note these variables can be only GLOBAL
1043 */
1046 
1047  public:
1048  Sys_var_keycache(const char *name_arg, const char *comment, int flag_args,
1049  ptrdiff_t off, size_t size, CMD_LINE getopt,
1050  ulonglong min_val, ulonglong max_val, ulonglong def_val,
1051  uint block_size, PolyLock *lock,
1052  enum binlog_status_enum binlog_status_arg,
1053  on_check_function on_check_func,
1054  keycache_update_function on_update_func,
1055  const char *substitute = 0)
1057  name_arg, comment, flag_args, -1, /* offset, see base class CTOR */
1058  size, getopt, min_val, max_val, def_val, block_size, lock,
1059  binlog_status_arg, on_check_func, 0, substitute),
1060  keycache_update(on_update_func) {
1061  offset = off; /* Remember offset in KEY_CACHE */
1062  option.var_type |= GET_ASK_ADDR;
1063  option.value = (uchar **)1; // crash me, please
1064  keycache_var(dflt_key_cache, off) = def_val;
1065  DBUG_ASSERT(scope() == GLOBAL);
1066  }
1067  bool global_update(THD *thd, set_var *var) {
1068  ulonglong new_value = var->save_result.ulonglong_value;
1069 
1070  if (var->base.str)
1072  ER_WARN_DEPRECATED_SYNTAX,
1073  "%s.%s syntax "
1074  "is deprecated and will be removed in a "
1075  "future release",
1076  var->base.str, name.str);
1077 
1079  /* If no basename, assume it's for the key cache named 'default' */
1081 
1082  KEY_CACHE *key_cache = get_key_cache(&base_name);
1083 
1084  if (!key_cache) { // Key cache didn't exists */
1085  if (!new_value) // Tried to delete cache
1086  return false; // Ok, nothing to do
1087  if (!(key_cache = create_key_cache(base_name.str, base_name.length)))
1088  return true;
1089  }
1090 
1091  /**
1092  Abort if some other thread is changing the key cache
1093  @todo This should be changed so that we wait until the previous
1094  assignment is done and then do the new assign
1095  */
1096  if (key_cache->in_init) return true;
1097 
1098  return keycache_update(thd, key_cache, offset, new_value);
1099  }
1100  const uchar *global_value_ptr(THD *thd, LEX_STRING *base) {
1101  if (base != NULL && base->str)
1103  ER_WARN_DEPRECATED_SYNTAX,
1104  "@@global.%s.%s syntax "
1105  "is deprecated and will be removed in a "
1106  "future release",
1107  base->str, name.str);
1108 
1109  LEX_CSTRING cstr = to_lex_cstring(*base);
1110  KEY_CACHE *key_cache = get_key_cache(&cstr);
1111  if (!key_cache) key_cache = &zero_key_cache;
1112  return keycache_var_ptr(key_cache, offset);
1113  }
1114 };
1115 
1116 /**
1117  The class for floating point variables
1118 
1119  Class specific constructor arguments: min, max
1120 
1121  Backing store: double
1122 */
1123 class Sys_var_double : public sys_var {
1124  public:
1126  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
1127  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, double min_val,
1128  double max_val, double def_val, PolyLock *lock = 0,
1129  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1130  on_check_function on_check_func = 0,
1131  on_update_function on_update_func = 0, const char *substitute = 0,
1132  int parse_flag = PARSE_NORMAL)
1133  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
1134  getopt.arg_type, SHOW_DOUBLE,
1135  (longlong)getopt_double2ulonglong(def_val), lock,
1136  binlog_status_arg, on_check_func, on_update_func, substitute,
1137  parse_flag) {
1138  option.var_type = GET_DOUBLE;
1139  option.min_value = (longlong)getopt_double2ulonglong(min_val);
1140  option.max_value = (longlong)getopt_double2ulonglong(max_val);
1141  global_var(double) = getopt_ulonglong2double(option.def_value);
1142  DBUG_ASSERT(min_val <= max_val);
1143  DBUG_ASSERT(min_val <= def_val);
1144  DBUG_ASSERT(max_val >= def_val);
1145  DBUG_ASSERT(size == sizeof(double));
1146  }
1147  bool do_check(THD *thd, set_var *var) {
1148  bool fixed;
1149  double v = var->value->val_real();
1150  var->save_result.double_value =
1151  getopt_double_limit_value(v, &option, &fixed);
1152 
1153  return throw_bounds_warning(thd, name.str, fixed, v);
1154  }
1155  bool session_update(THD *thd, set_var *var) {
1156  session_var(thd, double) = var->save_result.double_value;
1157  return false;
1158  }
1159  bool global_update(THD *, set_var *var) {
1160  global_var(double) = var->save_result.double_value;
1161  return false;
1162  }
1164  return type != INT_RESULT && type != REAL_RESULT && type != DECIMAL_RESULT;
1165  }
1167  var->save_result.double_value = global_var(double);
1168  }
1171  }
1172  void saved_value_to_string(THD *, set_var *var, char *def_val) {
1173  my_fcvt(var->save_result.double_value, 6, def_val, NULL);
1174  }
1175 };
1176 
1177 /**
1178  The class for @c test_flags (core_file for now).
1179  It's derived from Sys_var_bool.
1180 
1181  Class specific constructor arguments:
1182  Caller need not pass in a variable as we make up the value on the
1183  fly, that is, we derive it from the global test_flags bit vector.
1184 
1185  Backing store: bool
1186 */
1188  private:
1191 
1192  public:
1193  Sys_var_test_flag(const char *name_arg, const char *comment, uint mask)
1194  : Sys_var_bool(name_arg, comment,
1197  test_flag_mask = mask;
1198  }
1201  return (uchar *)&test_flag_value;
1202  }
1203 };
1204 
1205 /**
1206  The class for the @c max_user_connections.
1207  It's derived from Sys_var_uint, but non-standard session value
1208  requires a new class.
1209 
1210  Class specific constructor arguments:
1211  everything derived from Sys_var_uint
1212 
1213  Backing store: uint
1214 */
1216  public:
1218  const char *name_arg, const char *comment, int, ptrdiff_t off,
1219  size_t size, CMD_LINE getopt, uint min_val, uint max_val, uint def_val,
1220  uint block_size, PolyLock *lock = 0,
1221  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1222  on_check_function on_check_func = 0,
1223  on_update_function on_update_func = 0, const char *substitute = 0)
1224  : Sys_var_uint(name_arg, comment, SESSION, off, size, getopt, min_val,
1225  max_val, def_val, block_size, lock, binlog_status_arg,
1226  on_check_func, on_update_func, substitute) {}
1227  const uchar *session_value_ptr(THD *running_thd, THD *target_thd,
1228  LEX_STRING *base) {
1229  const USER_CONN *uc = target_thd->get_user_connect();
1230  if (uc && uc->user_resources.user_conn)
1231  return pointer_cast<const uchar *>(&(uc->user_resources.user_conn));
1232  return global_value_ptr(running_thd, base);
1233  }
1234 };
1235 
1236 // overflow-safe (1 << X)-1
1237 #define MAX_SET(X) ((((1ULL << ((X)-1)) - 1) << 1) | 1)
1238 
1239 /**
1240  The class for flagset variables - a variant of SET that allows in-place
1241  editing (turning on/off individual bits). String representations looks like
1242  a "flag=val,flag=val,...". Example: @@optimizer_switch
1243 
1244  Class specific constructor arguments:
1245  char* values[] - 0-terminated list of strings of valid values
1246 
1247  Backing store: ulonglong
1248 
1249  @note
1250  the last value in the values[] array should
1251  *always* be the string "default".
1252 */
1254  public:
1256  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
1257  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, const char *values[],
1258  ulonglong def_val, PolyLock *lock = 0,
1259  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1260  on_check_function on_check_func = 0,
1261  on_update_function on_update_func = 0, const char *substitute = 0)
1262  : Sys_var_typelib(name_arg, comment, flag_args, off, getopt, SHOW_CHAR,
1263  values, def_val, lock, binlog_status_arg, on_check_func,
1264  on_update_func, substitute) {
1265  option.var_type = GET_FLAGSET;
1266  global_var(ulonglong) = def_val;
1267  DBUG_ASSERT(typelib.count > 1);
1268  DBUG_ASSERT(typelib.count <= 65);
1269  DBUG_ASSERT(def_val < MAX_SET(typelib.count));
1270  DBUG_ASSERT(strcmp(values[typelib.count - 1], "default") == 0);
1271  DBUG_ASSERT(size == sizeof(ulonglong));
1272  }
1273  bool do_check(THD *thd, set_var *var) {
1274  char buff[STRING_BUFFER_USUAL_SIZE];
1275  String str(buff, sizeof(buff), system_charset_info), *res;
1276  ulonglong default_value, current_value;
1277  if (var->type == OPT_GLOBAL) {
1278  default_value = option.def_value;
1279  current_value = global_var(ulonglong);
1280  } else {
1281  default_value = global_var(ulonglong);
1282  current_value = session_var(thd, ulonglong);
1283  }
1284 
1285  if (var->value->result_type() == STRING_RESULT) {
1286  if (!(res = var->value->val_str(&str)))
1287  return true;
1288  else {
1289  const char *error;
1290  uint error_len;
1291 
1293  &typelib, typelib.count, current_value, default_value, res->ptr(),
1294  static_cast<uint>(res->length()), &error, &error_len);
1295  if (error) {
1296  ErrConvString err(error, error_len, res->charset());
1297  my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name.str, err.ptr());
1298  return true;
1299  }
1300  }
1301  } else {
1302  longlong tmp = var->value->val_int();
1303  if ((tmp < 0 && !var->value->unsigned_flag) ||
1304  (ulonglong)tmp > MAX_SET(typelib.count))
1305  return true;
1306  else
1307  var->save_result.ulonglong_value = tmp;
1308  }
1309 
1310  return false;
1311  }
1312  bool session_update(THD *thd, set_var *var) {
1314  return false;
1315  }
1316  bool global_update(THD *, set_var *var) {
1318  return false;
1319  }
1322  }
1324  var->save_result.ulonglong_value = option.def_value;
1325  }
1326  void saved_value_to_string(THD *thd, set_var *var, char *def_val) {
1327  strcpy(def_val, flagset_to_string(thd, 0, var->save_result.ulonglong_value,
1328  typelib.type_names));
1329  }
1330  const uchar *session_value_ptr(THD *running_thd, THD *target_thd,
1331  LEX_STRING *) {
1332  return (uchar *)flagset_to_string(
1333  running_thd, 0, session_var(target_thd, ulonglong), typelib.type_names);
1334  }
1336  return (uchar *)flagset_to_string(thd, 0, global_var(ulonglong),
1338  }
1339 };
1340 
1341 /**
1342  The class for SET variables - variables taking zero or more values
1343  from the given list. Example: @@sql_mode
1344 
1345  Class specific constructor arguments:
1346  char* values[] - 0-terminated list of strings of valid values
1347 
1348  Backing store: ulonglong
1349 */
1351  public:
1353  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
1354  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, const char *values[],
1355  ulonglong def_val, PolyLock *lock = 0,
1356  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1357  on_check_function on_check_func = 0,
1358  on_update_function on_update_func = 0, const char *substitute = 0)
1359  : Sys_var_typelib(name_arg, comment, flag_args, off, getopt, SHOW_CHAR,
1360  values, def_val, lock, binlog_status_arg, on_check_func,
1361  on_update_func, substitute) {
1362  option.var_type = GET_SET;
1363  global_var(ulonglong) = def_val;
1364  DBUG_ASSERT(typelib.count > 0);
1365  DBUG_ASSERT(typelib.count <= 64);
1366  DBUG_ASSERT(def_val < MAX_SET(typelib.count));
1367  DBUG_ASSERT(size == sizeof(ulonglong));
1368  }
1369  bool do_check(THD *, set_var *var) {
1370  char buff[STRING_BUFFER_USUAL_SIZE];
1371  String str(buff, sizeof(buff), system_charset_info), *res;
1372 
1373  if (var->value->result_type() == STRING_RESULT) {
1374  if (!(res = var->value->val_str(&str)))
1375  return true;
1376  else {
1377  char *error;
1378  uint error_len;
1379  bool not_used;
1380 
1382  find_set(&typelib, res->ptr(), static_cast<uint>(res->length()),
1383  NULL, &error, &error_len, &not_used);
1384  /*
1385  note, we only issue an error if error_len > 0.
1386  That is even while empty (zero-length) values are considered
1387  errors by find_set(), these errors are ignored here
1388  */
1389  if (error_len) {
1390  ErrConvString err(error, error_len, res->charset());
1391  my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name.str, err.ptr());
1392  return true;
1393  }
1394  }
1395  } else {
1396  longlong tmp = var->value->val_int();
1397  if ((tmp < 0 && !var->value->unsigned_flag) ||
1398  (ulonglong)tmp > MAX_SET(typelib.count))
1399  return true;
1400  else
1401  var->save_result.ulonglong_value = tmp;
1402  }
1403 
1404  return false;
1405  }
1406  bool session_update(THD *thd, set_var *var) {
1408  return false;
1409  }
1410  bool global_update(THD *, set_var *var) {
1412  return false;
1413  }
1416  }
1418  var->save_result.ulonglong_value = option.def_value;
1419  }
1420  void saved_value_to_string(THD *thd, set_var *var, char *def_val) {
1421  strcpy(def_val, set_to_string(thd, 0, var->save_result.ulonglong_value,
1422  typelib.type_names));
1423  }
1424  const uchar *session_value_ptr(THD *running_thd, THD *target_thd,
1425  LEX_STRING *) {
1426  return (uchar *)set_to_string(
1427  running_thd, 0, session_var(target_thd, ulonglong), typelib.type_names);
1428  }
1430  return (uchar *)set_to_string(thd, 0, global_var(ulonglong),
1432  }
1433 };
1434 
1435 /**
1436  The class for variables which value is a plugin.
1437  Example: @@default_storage_engine
1438 
1439  Class specific constructor arguments:
1440  int plugin_type_arg (for example MYSQL_STORAGE_ENGINE_PLUGIN)
1441 
1442  Backing store: plugin_ref
1443 
1444  @note
1445  these variables don't support command-line equivalents, any such
1446  command-line options should be added manually to my_long_options in mysqld.cc
1447 */
1448 class Sys_var_plugin : public sys_var {
1450 
1451  public:
1453  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
1454  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, int plugin_type_arg,
1455  char **def_val, PolyLock *lock = 0,
1456  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1457  on_check_function on_check_func = 0,
1458  on_update_function on_update_func = 0, const char *substitute = 0,
1459  int parse_flag = PARSE_NORMAL)
1460  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
1461  getopt.arg_type, SHOW_CHAR, (intptr)def_val, lock,
1462  binlog_status_arg, on_check_func, on_update_func, substitute,
1463  parse_flag),
1464  plugin_type(plugin_type_arg) {
1465  option.var_type = GET_STR;
1466  DBUG_ASSERT(size == sizeof(plugin_ref));
1467  DBUG_ASSERT(getopt.id == -1); // force NO_CMD_LINE
1468  }
1469  bool do_check(THD *thd, set_var *var) {
1470  char buff[STRING_BUFFER_USUAL_SIZE];
1471  String str(buff, sizeof(buff), system_charset_info), *res;
1472 
1473  /* NULLs can't be used as a default storage engine */
1474  if (!(res = var->value->val_str(&str))) return true;
1475 
1476  LEX_CSTRING pname_cstr = res->lex_cstring();
1478 
1479  // special code for storage engines (e.g. to handle historical aliases)
1481  plugin = ha_resolve_by_name(thd, &pname_cstr, false);
1482  else {
1483  plugin = my_plugin_lock_by_name(thd, pname_cstr, plugin_type);
1484  }
1485 
1486  if (!plugin) {
1487  // historically different error code
1489  ErrConvString err(res);
1490  my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), err.ptr());
1491  }
1492  return true;
1493  }
1494  var->save_result.plugin = plugin;
1495  return false;
1496  }
1497  void do_update(plugin_ref *valptr, plugin_ref newval) {
1498  plugin_ref oldval = *valptr;
1499  if (oldval != newval) {
1500  *valptr = my_plugin_lock(NULL, &newval);
1501  plugin_unlock(NULL, oldval);
1502  }
1503  }
1504  bool session_update(THD *thd, set_var *var) {
1506  return false;
1507  }
1508  bool global_update(THD *, set_var *var) {
1510  return false;
1511  }
1512  void session_save_default(THD *thd, set_var *var) {
1514  var->save_result.plugin = my_plugin_lock(thd, &plugin);
1515  }
1516  void global_save_default(THD *thd, set_var *var) {
1518  char **default_value = reinterpret_cast<char **>(option.def_value);
1519  pname.str = *default_value;
1520  pname.length = strlen(pname.str);
1521 
1524  plugin = ha_resolve_by_name(thd, &pname, false);
1525  else {
1527  }
1529 
1530  var->save_result.plugin = my_plugin_lock(thd, &plugin);
1531  }
1532  void saved_value_to_string(THD *, set_var *var, char *def_val) {
1533  strncpy(def_val, plugin_name(var->save_result.plugin)->str,
1535  }
1537  const uchar *session_value_ptr(THD *running_thd, THD *target_thd,
1538  LEX_STRING *) {
1539  plugin_ref plugin = session_var(target_thd, plugin_ref);
1540  return (uchar *)(plugin ? running_thd->strmake(plugin_name(plugin)->str,
1542  : 0);
1543  }
1546  return (uchar *)(plugin ? thd->strmake(plugin_name(plugin)->str,
1548  : 0);
1549  }
1550 };
1551 
1552 #if defined(ENABLED_DEBUG_SYNC)
1553 /**
1554  The class for @@debug_sync session-only variable
1555 */
1556 class Sys_var_debug_sync : public sys_var {
1557  public:
1558  Sys_var_debug_sync(
1559  const char *name_arg, const char *comment, int flag_args, CMD_LINE getopt,
1560  const char *def_val, PolyLock *lock = 0,
1561  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1562  on_check_function on_check_func = 0,
1563  on_update_function on_update_func = 0, const char *substitute = 0,
1564  int parse_flag = PARSE_NORMAL)
1565  : sys_var(&all_sys_vars, name_arg, comment, flag_args, 0, getopt.id,
1566  getopt.arg_type, SHOW_CHAR, (intptr)def_val, lock,
1567  binlog_status_arg, on_check_func, on_update_func, substitute,
1568  parse_flag) {
1569  DBUG_ASSERT(scope() == ONLY_SESSION);
1570  option.var_type = GET_NO_ARG;
1571  }
1572  bool do_check(THD *thd, set_var *var) {
1573  char buff[STRING_BUFFER_USUAL_SIZE];
1574  String str(buff, sizeof(buff), system_charset_info), *res;
1575 
1576  if (!(res = var->value->val_str(&str)))
1577  var->save_result.string_value.str = const_cast<char *>("");
1578  else
1580  thd->strmake(res->ptr(), res->length());
1581  return false;
1582  }
1583  bool session_update(THD *thd, set_var *var) {
1584  return debug_sync_update(thd, var->save_result.string_value.str);
1585  }
1586  bool global_update(THD *, set_var *) {
1587  DBUG_ASSERT(false);
1588  return true;
1589  }
1590  void session_save_default(THD *, set_var *var) {
1591  var->save_result.string_value.str = const_cast<char *>("");
1592  var->save_result.string_value.length = 0;
1593  }
1594  void global_save_default(THD *, set_var *) { DBUG_ASSERT(false); }
1595  void saved_value_to_string(THD *, set_var *, char *) { DBUG_ASSERT(false); }
1596  const uchar *session_value_ptr(THD *running_thd, THD *, LEX_STRING *) {
1597  return debug_sync_value_ptr(running_thd);
1598  }
1599  const uchar *global_value_ptr(THD *, LEX_STRING *) {
1600  DBUG_ASSERT(false);
1601  return 0;
1602  }
1603  bool check_update_type(Item_result type) { return type != STRING_RESULT; }
1604 };
1605 #endif /* defined(ENABLED_DEBUG_SYNC) */
1606 
1607 /**
1608  The class for bit variables - a variant of boolean that stores the value
1609  in a bit.
1610 
1611  Class specific constructor arguments:
1612  ulonglong bitmask_arg - the mask for the bit to set in the ulonglong
1613  backing store
1614 
1615  Backing store: ulonglong
1616 
1617  @note
1618  This class supports the "reverse" semantics, when the value of the bit
1619  being 0 corresponds to the value of variable being set. To activate it
1620  use REVERSE(bitmask) instead of simply bitmask in the constructor.
1621 
1622  @note
1623  variables of this class cannot be set from the command line as
1624  my_getopt does not support bits.
1625 */
1629  void set(uchar *ptr, ulonglong value) {
1630  if ((value != 0) ^ reverse_semantics)
1631  (*(ulonglong *)ptr) |= bitmask;
1632  else
1633  (*(ulonglong *)ptr) &= ~bitmask;
1634  }
1635 
1636  public:
1638  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
1639  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt,
1640  ulonglong bitmask_arg, bool def_val, PolyLock *lock = 0,
1641  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1642  on_check_function on_check_func = 0,
1643  on_update_function on_update_func = 0, const char *substitute = 0)
1644  : Sys_var_typelib(name_arg, comment, flag_args, off, getopt, SHOW_MY_BOOL,
1645  bool_values, def_val, lock, binlog_status_arg,
1646  on_check_func, on_update_func, substitute) {
1647  option.var_type = GET_BOOL;
1648  reverse_semantics = my_count_bits(bitmask_arg) > 1;
1649  bitmask = reverse_semantics ? ~bitmask_arg : bitmask_arg;
1650  set(global_var_ptr(), def_val);
1651  DBUG_ASSERT(getopt.id == -1); // force NO_CMD_LINE
1652  DBUG_ASSERT(size == sizeof(ulonglong));
1653  }
1654  bool session_update(THD *thd, set_var *var) {
1656  return false;
1657  }
1658  bool global_update(THD *, set_var *var) {
1660  return false;
1661  }
1664  }
1666  var->save_result.ulonglong_value = option.def_value;
1667  }
1668  void saved_value_to_string(THD *, set_var *var, char *def_val) {
1670  }
1671  const uchar *session_value_ptr(THD *running_thd, THD *target_thd,
1672  LEX_STRING *) {
1673  running_thd->sys_var_tmp.bool_value = static_cast<bool>(
1675  ((session_var(target_thd, ulonglong) & bitmask) != 0));
1676  return (uchar *)&running_thd->sys_var_tmp.bool_value;
1677  }
1679  thd->sys_var_tmp.bool_value = static_cast<bool>(
1681  return (uchar *)&thd->sys_var_tmp.bool_value;
1682  }
1683 };
1684 
1685 /**
1686  The class for variables that have a special meaning for a session,
1687  such as @@timestamp or @@rnd_seed1, their values typically cannot be read
1688  from SV structure, and a special "read" callback is provided.
1689 
1690  Class specific constructor arguments:
1691  everything derived from Sys_var_ulonglong
1692  session_special_read_function read_func_arg
1693 
1694  Backing store: ulonglong
1695 
1696  @note
1697  These variables are session-only, global or command-line equivalents
1698  are not supported as they're generally meaningless.
1699 */
1703 
1706 
1707  public:
1708  Sys_var_session_special(const char *name_arg, const char *comment,
1709  int flag_args, CMD_LINE getopt, ulonglong min_val,
1710  ulonglong max_val, uint block_size, PolyLock *lock,
1711  enum binlog_status_enum binlog_status_arg,
1712  on_check_function on_check_func,
1713  session_special_update_function update_func_arg,
1714  session_special_read_function read_func_arg,
1715  const char *substitute = 0)
1716  : Sys_var_ulonglong(name_arg, comment, flag_args, 0, sizeof(ulonglong),
1717  getopt, min_val, max_val, 0, block_size, lock,
1718  binlog_status_arg, on_check_func, 0, substitute),
1719  read_func(read_func_arg),
1720  update_func(update_func_arg) {
1722  DBUG_ASSERT(getopt.id == -1); // NO_CMD_LINE, because the offset is fake
1723  }
1724  bool session_update(THD *thd, set_var *var) { return update_func(thd, var); }
1726  DBUG_ASSERT(false);
1727  return true;
1728  }
1729  void session_save_default(THD *, set_var *var) { var->value = 0; }
1731  void saved_value_to_string(THD *, set_var *, char *) { DBUG_ASSERT(false); }
1732  const uchar *session_value_ptr(THD *running_thd, THD *target_thd,
1733  LEX_STRING *) {
1734  running_thd->sys_var_tmp.ulonglong_value = read_func(target_thd);
1735  return (uchar *)&running_thd->sys_var_tmp.ulonglong_value;
1736  }
1738  DBUG_ASSERT(false);
1739  return nullptr;
1740  }
1741 };
1742 
1743 /**
1744  Similar to Sys_var_session_special, but with double storage.
1745 */
1749 
1752 
1753  public:
1755  const char *name_arg, const char *comment, int flag_args, CMD_LINE getopt,
1756  double min_val, double max_val, uint, PolyLock *lock,
1757  enum binlog_status_enum binlog_status_arg,
1758  on_check_function on_check_func,
1759  session_special_update_function update_func_arg,
1761  const char *substitute = 0)
1762  : Sys_var_double(name_arg, comment, flag_args, 0, sizeof(double), getopt,
1763  min_val, max_val, 0.0, lock, binlog_status_arg,
1764  on_check_func, 0, substitute),
1765  read_func(read_func_arg),
1766  update_func(update_func_arg) {
1768  DBUG_ASSERT(getopt.id == -1); // NO_CMD_LINE, because the offset is fake
1769  }
1770  bool session_update(THD *thd, set_var *var) { return update_func(thd, var); }
1772  DBUG_ASSERT(false);
1773  return true;
1774  }
1775  void session_save_default(THD *, set_var *var) { var->value = 0; }
1777  void saved_value_to_string(THD *, set_var *, char *) { DBUG_ASSERT(false); }
1778  const uchar *session_value_ptr(THD *running_thd, THD *target_thd,
1779  LEX_STRING *) {
1780  running_thd->sys_var_tmp.double_value = read_func(target_thd);
1781  return (uchar *)&running_thd->sys_var_tmp.double_value;
1782  }
1784  DBUG_ASSERT(false);
1785  return nullptr;
1786  }
1787 };
1788 
1789 /**
1790  The class for read-only variables that show whether a particular
1791  feature is supported by the server. Example: have_compression
1792 
1793  Backing store: enum SHOW_COMP_OPTION
1794 
1795  @note
1796  These variables are necessarily read-only, only global, and have no
1797  command-line equivalent.
1798 */
1799 class Sys_var_have : public sys_var {
1800  public:
1802  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
1803  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, PolyLock *lock = 0,
1804  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1805  on_check_function on_check_func = 0,
1806  on_update_function on_update_func = 0, const char *substitute = 0,
1807  int parse_flag = PARSE_NORMAL)
1808  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
1809  getopt.arg_type, SHOW_CHAR, 0, lock, binlog_status_arg,
1810  on_check_func, on_update_func, substitute, parse_flag) {
1811  DBUG_ASSERT(scope() == GLOBAL);
1812  DBUG_ASSERT(getopt.id == -1);
1813  DBUG_ASSERT(lock == 0);
1814  DBUG_ASSERT(binlog_status_arg == VARIABLE_NOT_IN_BINLOG);
1816  DBUG_ASSERT(on_update == 0);
1817  DBUG_ASSERT(size == sizeof(enum SHOW_COMP_OPTION));
1818  }
1819  bool do_check(THD *, set_var *) {
1820  DBUG_ASSERT(false);
1821  return true;
1822  }
1824  DBUG_ASSERT(false);
1825  return true;
1826  }
1828  DBUG_ASSERT(false);
1829  return true;
1830  }
1833  void saved_value_to_string(THD *, set_var *, char *) {}
1835  DBUG_ASSERT(false);
1836  return nullptr;
1837  }
1839  return pointer_cast<const uchar *>(
1841  }
1842  bool check_update_type(Item_result) { return false; }
1843 };
1844 
1845 /**
1846  A subclass of @ref Sys_var_have to return dynamic values
1847 
1848  All the usual restrictions for @ref Sys_var_have apply.
1849  But instead of reading a global variable it calls a function
1850  to return the value.
1851  */
1853  public:
1854  /**
1855  Construct a new variable.
1856 
1857  @param name_arg The name of the variable
1858  @param comment Explanation of what the variable does
1859  @param func The function to call when in need to read the global value
1860  */
1861  Sys_var_have_func(const char *name_arg, const char *comment,
1862  enum SHOW_COMP_OPTION (*func)(THD *))
1863  /*
1864  Note: it doesn't really matter what variable we use, as long as we are
1865  using one. So we use a local static dummy
1866  */
1867  : Sys_var_have(name_arg, comment,
1869  func_(func) {}
1870 
1872  return pointer_cast<const uchar *>(show_comp_option_name[func_(thd)]);
1873  }
1874 
1875  protected:
1878 };
1879 /**
1880  Generic class for variables for storing entities that are internally
1881  represented as structures, have names, and possibly can be referred to by
1882  numbers. Examples: character sets, collations, locales,
1883 
1884  Backing store: void*
1885  @tparam Struct_type type of struct being wrapped
1886  @tparam Name_getter must provide Name_getter(Struct_type*).get_name()
1887 
1888  @note
1889  As every such a structure requires special treatment from my_getopt,
1890  these variables don't support command-line equivalents, any such
1891  command-line options should be added manually to my_long_options in mysqld.cc
1892 */
1893 template <typename Struct_type, typename Name_getter>
1894 class Sys_var_struct : public sys_var {
1895  public:
1897  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
1898  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, void *def_val,
1899  PolyLock *lock = 0,
1900  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1901  on_check_function on_check_func = 0,
1902  on_update_function on_update_func = 0, const char *substitute = 0,
1903  int parse_flag = PARSE_NORMAL)
1904  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
1905  getopt.arg_type, SHOW_CHAR, (intptr)def_val, lock,
1906  binlog_status_arg, on_check_func, on_update_func, substitute,
1907  parse_flag) {
1908  option.var_type = GET_STR;
1909  /*
1910  struct variables are special on the command line - often (e.g. for
1911  charsets) the name cannot be immediately resolved, but only after all
1912  options (in particular, basedir) are parsed.
1913 
1914  thus all struct command-line options should be added manually
1915  to my_long_options in mysqld.cc
1916  */
1917  DBUG_ASSERT(getopt.id == -1);
1918  DBUG_ASSERT(size == sizeof(void *));
1919  }
1920  bool do_check(THD *, set_var *) { return false; }
1921  bool session_update(THD *thd, set_var *var) {
1922  session_var(thd, const void *) = var->save_result.ptr;
1923  return false;
1924  }
1925  bool global_update(THD *, set_var *var) {
1926  global_var(const void *) = var->save_result.ptr;
1927  return false;
1928  }
1930  var->save_result.ptr = global_var(void *);
1931  }
1933  void **default_value = reinterpret_cast<void **>(option.def_value);
1934  var->save_result.ptr = *default_value;
1935  }
1936  void saved_value_to_string(THD *, set_var *var, char *def_val) {
1937  const Struct_type *ptr =
1938  static_cast<const Struct_type *>(var->save_result.ptr);
1939  if (ptr) strcpy(def_val, (char *)Name_getter(ptr).get_name());
1940  }
1942  return type != INT_RESULT && type != STRING_RESULT;
1943  }
1944  const uchar *session_value_ptr(THD *, THD *target_thd, LEX_STRING *) {
1945  const Struct_type *ptr = session_var(target_thd, const Struct_type *);
1946  return ptr ? Name_getter(ptr).get_name() : nullptr;
1947  }
1949  const Struct_type *ptr = global_var(const Struct_type *);
1950  return ptr ? Name_getter(ptr).get_name() : nullptr;
1951  }
1952 };
1953 
1954 /**
1955  The class for variables that store time zones
1956 
1957  Backing store: Time_zone*
1958 
1959  @note
1960  Time zones cannot be supported directly by my_getopt, thus
1961  these variables don't support command-line equivalents, any such
1962  command-line options should be added manually to my_long_options in mysqld.cc
1963 */
1964 class Sys_var_tz : public sys_var {
1965  public:
1966  Sys_var_tz(const char *name_arg, const char *comment, int flag_args,
1967  ptrdiff_t off, size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt,
1968  Time_zone **def_val, PolyLock *lock = 0,
1969  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1970  on_check_function on_check_func = 0,
1971  on_update_function on_update_func = 0, const char *substitute = 0,
1972  int parse_flag = PARSE_NORMAL)
1973  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
1974  getopt.arg_type, SHOW_CHAR, (intptr)def_val, lock,
1975  binlog_status_arg, on_check_func, on_update_func, substitute,
1976  parse_flag) {
1977  DBUG_ASSERT(getopt.id == -1);
1978  DBUG_ASSERT(size == sizeof(Time_zone *));
1979  option.var_type = GET_STR;
1980  }
1981  bool do_check(THD *thd, set_var *var) {
1982  char buff[MAX_TIME_ZONE_NAME_LENGTH];
1983  String str(buff, sizeof(buff), &my_charset_latin1);
1984  String *res = var->value->val_str(&str);
1985 
1986  if (!res) return true;
1987 
1988  if (!(var->save_result.time_zone = my_tz_find(thd, res))) {
1989  ErrConvString err(res);
1990  my_error(ER_UNKNOWN_TIME_ZONE, MYF(0), err.ptr());
1991  return true;
1992  }
1993  return false;
1994  }
1995  bool session_update(THD *thd, set_var *var) {
1996  session_var(thd, Time_zone *) = var->save_result.time_zone;
1997  return false;
1998  }
1999  bool global_update(THD *, set_var *var) {
2001  return false;
2002  }
2005  }
2007  var->save_result.time_zone = *(Time_zone **)(intptr)option.def_value;
2008  }
2009  void saved_value_to_string(THD *, set_var *var, char *def_val) {
2010  strcpy(def_val, var->save_result.time_zone->get_name()->ptr());
2011  }
2012  const uchar *session_value_ptr(THD *, THD *target_thd, LEX_STRING *) {
2013  /*
2014  This is an ugly fix for replication: we don't replicate properly queries
2015  invoking system variables' values to update tables; but
2016  CONVERT_TZ(,,@@session.time_zone) is so popular that we make it
2017  replicable (i.e. we tell the binlog code to store the session
2018  timezone). If it's the global value which was used we can't replicate
2019  (binlog code stores session value only).
2020  */
2021  target_thd->time_zone_used = true;
2022  return pointer_cast<const uchar *>(
2023  session_var(target_thd, Time_zone *)->get_name()->ptr());
2024  }
2026  return pointer_cast<const uchar *>(
2027  global_var(Time_zone *)->get_name()->ptr());
2028  }
2030 };
2031 
2032 /**
2033  Class representing the 'transaction_isolation' system variable. This
2034  variable can also be indirectly set using 'SET TRANSACTION ISOLATION
2035  LEVEL'.
2036 */
2037 
2039  public:
2040  Sys_var_transaction_isolation(const char *name_arg, const char *comment,
2041  int flag_args, ptrdiff_t off, size_t size,
2042  CMD_LINE getopt, const char *values[],
2043  uint def_val, PolyLock *lock,
2044  enum binlog_status_enum binlog_status_arg,
2045  on_check_function on_check_func)
2046  : Sys_var_enum(name_arg, comment, flag_args, off, size, getopt, values,
2047  def_val, lock, binlog_status_arg, on_check_func) {}
2048  virtual bool session_update(THD *thd, set_var *var);
2049 };
2050 
2051 /**
2052  Class representing the tx_read_only system variable for setting
2053  default transaction access mode.
2054 
2055  Note that there is a special syntax - SET TRANSACTION READ ONLY
2056  (or READ WRITE) that sets the access mode for the next transaction
2057  only.
2058 */
2059 
2061  public:
2062  Sys_var_transaction_read_only(const char *name_arg, const char *comment,
2063  int flag_args, ptrdiff_t off, size_t size,
2064  CMD_LINE getopt, bool def_val, PolyLock *lock,
2065  enum binlog_status_enum binlog_status_arg,
2066  on_check_function on_check_func)
2067  : Sys_var_bool(name_arg, comment, flag_args, off, size, getopt, def_val,
2068  lock, binlog_status_arg, on_check_func) {}
2069  virtual bool session_update(THD *thd, set_var *var);
2070 };
2071 
2072 /**
2073  A class for @@global.binlog_checksum that has
2074  a specialized update method.
2075 */
2077  public:
2078  Sys_var_enum_binlog_checksum(const char *name_arg, const char *comment,
2079  int flag_args, ptrdiff_t off, size_t size,
2080  CMD_LINE getopt, const char *values[],
2081  uint def_val, PolyLock *lock,
2082  enum binlog_status_enum binlog_status_arg,
2083  on_check_function on_check_func = 0)
2084  : Sys_var_enum(name_arg, comment, flag_args | PERSIST_AS_READ_ONLY, off,
2085  size, getopt, values, def_val, lock, binlog_status_arg,
2086  on_check_func, NULL) {}
2087  virtual bool global_update(THD *thd, set_var *var);
2088 };
2089 
2090 /**
2091  Class for gtid_next.
2092 */
2093 class Sys_var_gtid_next : public sys_var {
2094  public:
2096  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
2097  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, const char *def_val,
2098  PolyLock *lock = 0,
2099  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
2100  on_check_function on_check_func = 0,
2101  on_update_function on_update_func = 0, const char *substitute = 0,
2102  int parse_flag = PARSE_NORMAL)
2103  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
2104  getopt.arg_type, SHOW_CHAR, (intptr)def_val, lock,
2105  binlog_status_arg, on_check_func, on_update_func, substitute,
2106  parse_flag) {
2107  DBUG_ASSERT(size == sizeof(Gtid_specification));
2108  }
2109  bool session_update(THD *thd, set_var *var);
2110 
2112  DBUG_ASSERT(false);
2113  return true;
2114  }
2116  DBUG_ENTER("Sys_var_gtid_next::session_save_default");
2117  char *ptr = (char *)(intptr)option.def_value;
2118  var->save_result.string_value.str = ptr;
2119  var->save_result.string_value.length = ptr ? strlen(ptr) : 0;
2121  }
2123  void saved_value_to_string(THD *, set_var *, char *) { DBUG_ASSERT(false); }
2124  bool do_check(THD *, set_var *) { return false; }
2126  const uchar *session_value_ptr(THD *running_thd, THD *target_thd,
2127  LEX_STRING *) {
2128  DBUG_ENTER("Sys_var_gtid_next::session_value_ptr");
2131  ((Gtid_specification *)session_var_ptr(target_thd))
2132  ->to_string(global_sid_map, buf);
2134  char *ret = running_thd->mem_strdup(buf);
2135  DBUG_RETURN((uchar *)ret);
2136  }
2138  DBUG_ASSERT(false);
2139  return nullptr;
2140  }
2141 };
2142 
2143 #ifdef HAVE_GTID_NEXT_LIST
2144 /**
2145  Class for variables that store values of type Gtid_set.
2146 
2147  The back-end storage should be a Gtid_set_or_null, and it should be
2148  set to null by default. When the variable is set for the first
2149  time, the Gtid_set* will be allocated.
2150 */
2151 class Sys_var_gtid_set : public sys_var {
2152  public:
2153  Sys_var_gtid_set(
2154  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
2155  size_t size, CMD_LINE getopt, const char *def_val, PolyLock *lock = 0,
2156  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
2157  on_check_function on_check_func = 0,
2158  on_update_function on_update_func = 0, const char *substitute = 0,
2159  int parse_flag = PARSE_NORMAL)
2160  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
2161  getopt.arg_type, SHOW_CHAR, (intptr)def_val, lock,
2162  binlog_status_arg, on_check_func, on_update_func, substitute,
2163  parse_flag) {
2164  DBUG_ASSERT(size == sizeof(Gtid_set_or_null));
2165  }
2166  bool session_update(THD *thd, set_var *var);
2167 
2168  bool global_update(THD *thd, set_var *var) {
2169  DBUG_ASSERT(false);
2170  return true;
2171  }
2172  void session_save_default(THD *thd, set_var *var) {
2173  DBUG_ENTER("Sys_var_gtid_set::session_save_default");
2175  char *ptr = (char *)(intptr)option.def_value;
2176  var->save_result.string_value.str = ptr;
2177  var->save_result.string_value.length = ptr ? strlen(ptr) : 0;
2180  }
2181  void global_save_default(THD *thd, set_var *var) { DBUG_ASSERT(false); }
2182  void saved_value_to_string(THD *, set_var *, char *) { DBUG_ASSERT(false); }
2183  bool do_check(THD *thd, set_var *var) {
2184  DBUG_ENTER("Sys_var_gtid_set::do_check");
2185  String str;
2186  String *res = var->value->val_str(&str);
2187  if (res == NULL) {
2189  DBUG_RETURN(false);
2190  }
2191  DBUG_ASSERT(res->ptr() != NULL);
2192  var->save_result.string_value.str = thd->strmake(res->ptr(), res->length());
2193  if (var->save_result.string_value.str == NULL) {
2194  my_error(ER_OUT_OF_RESOURCES, MYF(0)); // thd->strmake failed
2195  DBUG_RETURN(1);
2196  }
2197  var->save_result.string_value.length = res->length();
2198  bool ret = !Gtid_set::is_valid(res->ptr());
2199  DBUG_RETURN(ret);
2200  }
2201  bool check_update_type(Item_result type) { return type != STRING_RESULT; }
2202  uchar *session_value_ptr(THD *running_thd, THD *target_thd,
2203  LEX_STRING *base) {
2204  DBUG_ENTER("Sys_var_gtid_set::session_value_ptr");
2205  Gtid_set_or_null *gsn = (Gtid_set_or_null *)session_var_ptr(target_thd);
2206  Gtid_set *gs = gsn->get_gtid_set();
2207  if (gs == NULL) DBUG_RETURN(NULL);
2208  char *buf;
2210  buf = (char *)running_thd->alloc(gs->get_string_length() + 1);
2211  if (buf)
2212  gs->to_string(buf);
2213  else
2214  my_error(ER_OUT_OF_RESOURCES, MYF(0)); // thd->alloc failed
2216  DBUG_RETURN((uchar *)buf);
2217  }
2218  uchar *global_value_ptr(THD *thd, LEX_STRING *base) {
2219  DBUG_ASSERT(false);
2220  return NULL;
2221  }
2222 };
2223 #endif
2224 
2225 /**
2226  Abstract base class for read-only variables (global or session) of
2227  string type where the value is generated by some function. This
2228  needs to be subclassed; the session_value_ptr or global_value_ptr
2229  function should be overridden. Since these variables cannot be
2230  set at command line, they cannot be persisted.
2231 */
2233  public:
2234  Sys_var_charptr_func(const char *name_arg, const char *comment,
2235  flag_enum flag_arg)
2236  : sys_var(&all_sys_vars, name_arg, comment,
2237  READ_ONLY NON_PERSIST flag_arg, 0 /*off*/, NO_CMD_LINE.id,
2238  NO_CMD_LINE.arg_type, SHOW_CHAR, (intptr)0 /*def_val*/,
2239  NULL /*polylock*/, VARIABLE_NOT_IN_BINLOG,
2240  NULL /*on_check_func*/, NULL /*on_update_func*/,
2241  NULL /*substitute*/, PARSE_NORMAL /*parse_flag*/) {
2242  DBUG_ASSERT(flag_arg == sys_var::GLOBAL || flag_arg == sys_var::SESSION ||
2243  flag_arg == sys_var::ONLY_SESSION);
2244  }
2246  DBUG_ASSERT(false);
2247  return true;
2248  }
2250  DBUG_ASSERT(false);
2251  return true;
2252  }
2255  void saved_value_to_string(THD *, set_var *, char *) { DBUG_ASSERT(false); }
2256  bool do_check(THD *, set_var *) {
2257  DBUG_ASSERT(false);
2258  return true;
2259  }
2261  DBUG_ASSERT(false);
2262  return true;
2263  }
2264  virtual const uchar *session_value_ptr(THD *, THD *, LEX_STRING *) {
2265  DBUG_ASSERT(false);
2266  return nullptr;
2267  }
2268  virtual const uchar *global_value_ptr(THD *, LEX_STRING *) {
2269  DBUG_ASSERT(false);
2270  return nullptr;
2271  }
2272 };
2273 
2274 /**
2275  Class for @@global.gtid_executed.
2276 */
2278  public:
2279  Sys_var_gtid_executed(const char *name_arg, const char *comment_arg)
2280  : Sys_var_charptr_func(name_arg, comment_arg, GLOBAL) {}
2281 
2283  DBUG_ENTER("Sys_var_gtid_executed::global_value_ptr");
2285  const Gtid_set *gs = gtid_state->get_executed_gtids();
2286  char *buf = (char *)thd->alloc(gs->get_string_length() + 1);
2287  if (buf == NULL)
2288  my_error(ER_OUT_OF_RESOURCES, MYF(0));
2289  else
2290  gs->to_string(buf);
2292  DBUG_RETURN((uchar *)buf);
2293  }
2294 };
2295 
2296 /**
2297  Class for @@session.gtid_purged.
2298 */
2300  public:
2302  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
2303  size_t, CMD_LINE getopt, const char *def_val, PolyLock *lock = 0,
2304  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
2305  on_check_function on_check_func = 0,
2306  on_update_function on_update_func = 0, const char *substitute = 0,
2307  int parse_flag = PARSE_NORMAL)
2308  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
2309  getopt.arg_type, SHOW_CHAR, (intptr)def_val, lock,
2310  binlog_status_arg, on_check_func, on_update_func, substitute,
2311  parse_flag) {}
2312 
2314  DBUG_ASSERT(false);
2315  return true;
2316  }
2317 
2319 
2320  bool global_update(THD *thd, set_var *var);
2321 
2323  /* gtid_purged does not have default value */
2324  my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str);
2325  }
2326  void saved_value_to_string(THD *, set_var *var, char *) {
2327  my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str);
2328  }
2329 
2330  bool do_check(THD *thd, set_var *var) {
2331  DBUG_ENTER("Sys_var_gtid_purged::do_check");
2332  char buf[1024];
2333  String str(buf, sizeof(buf), system_charset_info);
2334  String *res = var->value->val_str(&str);
2335  if (!res) DBUG_RETURN(true);
2337  thd->strmake(res->c_ptr(), res->length());
2338  if (!var->save_result.string_value.str) {
2339  my_error(ER_OUT_OF_RESOURCES, MYF(0)); // thd->strmake failed
2340  DBUG_RETURN(true);
2341  }
2342  var->save_result.string_value.length = res->length();
2343  bool ret =
2345  DBUG_PRINT("info", ("ret=%d", ret));
2346  DBUG_RETURN(ret);
2347  }
2348 
2350 
2352  DBUG_ENTER("Sys_var_gtid_purged::global_value_ptr");
2353  const Gtid_set *gs;
2355  if (opt_bin_log)
2356  gs = gtid_state->get_lost_gtids();
2357  else
2358  /*
2359  When binlog is off, report @@GLOBAL.GTID_PURGED from
2360  executed_gtids, since @@GLOBAL.GTID_PURGED and
2361  @@GLOBAL.GTID_EXECUTED are always same, so we did not
2362  save gtid into lost_gtids for every transaction for
2363  improving performance.
2364  */
2366  char *buf = (char *)thd->alloc(gs->get_string_length() + 1);
2367  if (buf == NULL)
2368  my_error(ER_OUT_OF_RESOURCES, MYF(0));
2369  else
2370  gs->to_string(buf);
2372  DBUG_RETURN((uchar *)buf);
2373  }
2374 
2376  DBUG_ASSERT(false);
2377  return nullptr;
2378  }
2379 };
2380 
2382  public:
2383  Sys_var_gtid_owned(const char *name_arg, const char *comment_arg)
2384  : Sys_var_charptr_func(name_arg, comment_arg, SESSION) {}
2385 
2386  public:
2387  const uchar *session_value_ptr(THD *running_thd, THD *target_thd,
2388  LEX_STRING *) {
2389  DBUG_ENTER("Sys_var_gtid_owned::session_value_ptr");
2390  char *buf = NULL;
2391  bool remote = (target_thd != running_thd);
2392 
2393  if (target_thd->owned_gtid.sidno == 0)
2394  DBUG_RETURN((uchar *)running_thd->mem_strdup(""));
2395  else if (target_thd->owned_gtid.sidno == THD::OWNED_SIDNO_ANONYMOUS) {
2397  DBUG_RETURN((uchar *)running_thd->mem_strdup("ANONYMOUS"));
2398  } else if (target_thd->owned_gtid.sidno == THD::OWNED_SIDNO_GTID_SET) {
2399 #ifdef HAVE_GTID_NEXT_LIST
2400  buf = (char *)running_thd->alloc(
2401  target_thd->owned_gtid_set.get_string_length() + 1);
2402  if (buf) {
2404  target_thd->owned_gtid_set.to_string(buf);
2406  } else
2407  my_error(ER_OUT_OF_RESOURCES, MYF(0));
2408 #else
2409  DBUG_ASSERT(0);
2410 #endif
2411  } else {
2412  buf = (char *)running_thd->alloc(Gtid::MAX_TEXT_LENGTH + 1);
2413  if (buf) {
2414  /* Take the lock if accessing another session. */
2415  if (remote) global_sid_lock->rdlock();
2416  running_thd->owned_gtid.to_string(target_thd->owned_sid, buf);
2417  if (remote) global_sid_lock->unlock();
2418  } else
2419  my_error(ER_OUT_OF_RESOURCES, MYF(0));
2420  }
2421  DBUG_RETURN((uchar *)buf);
2422  }
2423 
2425  DBUG_ENTER("Sys_var_gtid_owned::global_value_ptr");
2426  const Owned_gtids *owned_gtids = gtid_state->get_owned_gtids();
2428  char *buf = (char *)thd->alloc(owned_gtids->get_max_string_length());
2429  if (buf)
2430  owned_gtids->to_string(buf);
2431  else
2432  my_error(ER_OUT_OF_RESOURCES, MYF(0)); // thd->alloc failed
2434  DBUG_RETURN((uchar *)buf);
2435  }
2436 };
2437 
2439  public:
2441  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
2442  size_t size, CMD_LINE getopt, const char *values[], uint def_val,
2443  PolyLock *lock = 0,
2444  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
2445  on_check_function on_check_func = 0)
2446  : Sys_var_enum(name_arg, comment, flag_args, off, size, getopt, values,
2447  def_val, lock, binlog_status_arg, on_check_func) {}
2448 
2449  bool global_update(THD *thd, set_var *var);
2450 };
2451 
2453  public:
2455  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
2456  size_t size, CMD_LINE getopt, const ALIAS aliases[],
2458  PolyLock *lock = 0,
2459  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
2460  on_check_function on_check_func = 0)
2461  : Sys_var_multi_enum(name_arg, comment, flag_args, off, size, getopt,
2463  lock, binlog_status_arg, on_check_func) {}
2464 
2465  bool global_update(THD *thd, set_var *var);
2466 };
2467 
2469  public:
2470  Sys_var_binlog_encryption(const char *name_arg, const char *comment,
2471  int flag_args, ptrdiff_t off, size_t size,
2472  CMD_LINE getopt, bool def_val, PolyLock *lock,
2473  enum binlog_status_enum binlog_status_arg,
2474  on_check_function on_check_func)
2475  : Sys_var_bool(name_arg, comment, flag_args | PERSIST_AS_READ_ONLY, off,
2476  size, getopt, def_val, lock, binlog_status_arg,
2477  on_check_func) {}
2478  virtual bool global_update(THD *thd, set_var *var) override;
2479 };
2480 
2481 #endif /* SYS_VARS_H_INCLUDED */
void session_save_default(THD *, set_var *)
save the session default value of the variable in var
Definition: sys_vars.h:1831
Definition: set_var.h:109
LEX_CSTRING name
Definition: set_var.h:105
double double_value
Definition: sql_class.h:2376
void do_update(plugin_ref *valptr, plugin_ref newval)
Definition: sys_vars.h:1497
get_opt_arg_type
Enumeration of the my_option::arg_type attributes.
Definition: my_getopt.h:78
Definition: sql_plugin_ref.h:44
The class for string variables.
Definition: sys_vars.h:927
The class for floating point variables.
Definition: sys_vars.h:1123
Definition: set_var.h:108
Sys_var_gtid_mode(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, const char *values[], uint def_val, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0)
Definition: sys_vars.h:2440
unsigned long long int ulonglong
Definition: my_inttypes.h:74
Sys_var_integer< int32, GET_UINT, SHOW_INT, false > Sys_var_int32
Definition: sys_vars.h:303
const CHARSET_INFO * charset(THD *thd)
Definition: set_var.cc:556
#define DBUG_RETURN(a1)
Definition: my_dbug.h:139
not valid for UDFs
Definition: udf_registration_types.h:44
Definition: system_variables.h:174
Sys_var_set(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, const char *values[], ulonglong def_val, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0)
Definition: sys_vars.h:1352
LEX_STRING * plugin_name(st_plugin_int **ref)
Definition: sql_plugin_ref.h:94
int to_string(const rpl_sid &sid, char *buf) const
Convert a Gtid to a string.
Definition: rpl_gtid_misc.cc:158
virtual double val_real()=0
bool session_update(THD *, set_var *)
Definition: sys_vars.h:2245
enum SHOW_COMP_OPTION(* func_)(THD *)
Definition: sys_vars.h:1876
unsigned char uchar
Definition: my_inttypes.h:51
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:820
char * str
Definition: mysql_lex_string.h:35
Definition: sql_error.h:220
Our own string classes, used pervasively throughout the executor.
void rdlock()
Acquire the read lock.
Definition: rpl_gtid.h:453
"public" interface to sys_var - server configuration variables.
const uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:720
Item_result
Type of the user defined function return slot and arguments
Definition: udf_registration_types.h:38
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:276
int to_string(char *out) const
Write a string representation of this Owned_gtids to the given buffer.
Definition: rpl_gtid.h:2332
not valid for UDFs
Definition: udf_registration_types.h:40
const uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:1783
bool check_update_type(Item_result)
Definition: sys_vars.h:1842
Sys_var_gtid_next(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, const char *def_val, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0, int parse_flag=PARSE_NORMAL)
Definition: sys_vars.h:2095
plugin_ref ha_resolve_by_name(THD *thd, const LEX_CSTRING *name, bool is_temp_table)
Return the storage engine handlerton for the supplied name.
Definition: handler.cc:418
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
int plugin_type
Definition: sys_vars.h:1449
A class for @global.binlog_checksum that has a specialized update method.
Definition: sys_vars.h:2076
bool session_update(THD *, set_var *)
Definition: sys_vars.h:881
uint command_line_no_value
Definition: sys_vars.h:738
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:1159
Definition: mysql_lex_string.h:34
#define GET_STR_ALLOC
Definition: my_getopt.h:50
T pointer_cast(void *p)
Casts from one pointer type, to another, without using reinterpret_cast or C-style cast: foo f; bar *...
Definition: template_utils.h:70
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:2322
void global_save_default(THD *, set_var *)
save the global default value of the variable in var
Definition: sys_vars.h:2122
Definition: sys_vars.h:843
Definition: set_var.h:111
bool reverse_semantics
Definition: sys_vars.h:1628
MYSQL_PLUGIN_IMPORT CHARSET_INFO * system_charset_info
Definition: mysqld.cc:1318
bool(* session_special_update_function)(THD *thd, set_var *var)
Definition: sys_vars.h:1701
KEY_CACHE zero_key_cache
@nonexistent_cache.param->value_ptr() points here
Definition: keycaches.cc:66
Some useful bit functions.
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:461
The class for bit variables - a variant of boolean that stores the value in a bit.
Definition: sys_vars.h:1626
#define base_name(A)
Definition: my_sys.h:713
Sys_var_transaction_isolation(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, const char *values[], uint def_val, PolyLock *lock, enum binlog_status_enum binlog_status_arg, on_check_function on_check_func)
Definition: sys_vars.h:2040
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1995
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:285
static mi_bit_type mask[]
Definition: mi_packrec.cc:138
bool check_update_type(Item_result type)
Definition: sys_vars.h:1536
Definition: keycache.h:70
Sys_var_typelib(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, CMD_LINE getopt, SHOW_TYPE show_val_type_arg, const char *values[], ulonglong 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=PARSE_NORMAL)
Definition: sys_vars.h:320
static uint my_count_bits(ulonglong v)
Definition: my_bit.h:53
const uchar * global_value_ptr(THD *thd, LEX_STRING *base)
Definition: sys_vars.h:1100
const uchar * session_value_ptr(THD *running_thd, THD *, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:1012
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:814
File containing constants that can be used throughout the server.
void global_save_default(THD *thd, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:1516
Definition: set_var.h:115
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1504
bool unsigned_flag
Definition: item.h:2737
const uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:419
Some integer typedefs for easier portability.
ulonglong getopt_double2ulonglong(double v)
Returns an ulonglong value containing a raw representation of the given double value.
Definition: my_getopt.cc:153
Sys_var_test_flag(const char *name_arg, const char *comment, uint mask)
Definition: sys_vars.h:1193
void my_error(int nr, myf MyFlags,...)
Fill in and print a previously registered error message.
Definition: my_error.cc:215
bool do_check(THD *, set_var *var)
Definition: sys_vars.h:1369
unsigned int * type_lengths
Definition: typelib.h:38
#define bool
Definition: config_static.h:42
bool global_update(THD *, set_var *)
Definition: sys_vars.h:2249
#define GET_STR
Definition: my_getopt.h:49
Definition: set_var.h:135
The class for variables which value is a plugin.
Definition: sys_vars.h:1448
uint user_conn
Definition: sql_connect.h:51
int find_value(const char *text)
Return the numeric value for a given alias string, or -1 if the string is not a valid alias...
Definition: sys_vars.h:578
const ALIAS * aliases
Array of all textual aliases.
Definition: sys_vars.h:729
#define keycache_var(KC, OFF)
Definition: sys_vars.h:1029
const uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:1199
void saved_value_to_string(THD *, set_var *var, char *def_val)
This function converts value stored in save_result to string.
Definition: sys_vars.h:288
static const int PARSE_NORMAL
Definition: set_var.h:129
bool check_update_type(Item_result type)
Definition: sys_vars.h:2349
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:2115
Sys_var_double(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, double min_val, double max_val, double def_val, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0, int parse_flag=PARSE_NORMAL)
Definition: sys_vars.h:1125
static bool needs_conversion(size_t arg_length, const CHARSET_INFO *cs_from, const CHARSET_INFO *cs_to, size_t *offset)
Definition: sql_string.cc:268
const char * command_line_value
Pointer to the value set by the command line (set by the command line parser, copied to the global va...
Definition: sys_vars.h:737
const char ** type_names
Definition: typelib.h:37
const char * str
Definition: mysql_lex_string.h:40
int find_type(const char *x, const TYPELIB *typelib, unsigned int flags)
Search after a string in a list of strings.
Definition: typelib.cc:86
bool check_update_type(Item_result type)
Definition: sys_vars.h:361
~Sys_var_version()
Definition: sys_vars.h:851
struct System_variables variables
Definition: sql_class.h:956
void saved_value_to_string(THD *, set_var *var, char *def_val)
This function converts value stored in save_result to string.
Definition: sys_vars.h:412
uint number
Definition: sys_vars.h:497
bool check_update_type(Item_result)
Definition: sys_vars.h:2260
const uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:2137
const uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:1678
#define GET_FLAGSET
Definition: my_getopt.h:55
const uchar * session_value_ptr(THD *, THD *, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:1834
bool global_update(THD *thd, set_var *var)
This function shall be called whenever the global scope of gtid_mode var is updated.
Definition: sys_vars.cc:3879
virtual longlong val_int()=0
Definition: mysql_lex_string.h:39
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:1932
void wrlock()
Acquire the write lock.
Definition: rpl_gtid.h:462
Sergei Dialog Client Authentication NULL
Definition: dialog.cc:352
#define MYSQL_STORAGE_ENGINE_PLUGIN
Definition: plugin.h:105
const Gtid_set * get_lost_gtids() const
Return a pointer to the Gtid_set that contains the lost gtids.
Definition: rpl_gtid.h:3030
union set_var::@91 save_result
Sys_var_enum_binlog_checksum(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, const char *values[], uint def_val, PolyLock *lock, enum binlog_status_enum binlog_status_arg, on_check_function on_check_func=0)
Definition: sys_vars.h:2078
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:2003
bool global_update(THD *thd, set_var *var)
Definition: sys_vars.h:1067
void session_save_default(THD *, set_var *)
save the session default value of the variable in var
Definition: sys_vars.h:889
const uchar * session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:1424
Sys_var_integer< ha_rows, GET_HA_ROWS, SHOW_HA_ROWS, false > Sys_var_harows
Definition: sys_vars.h:307
void saved_value_to_string(THD *, set_var *var, char *def_val)
This function converts value stored in save_result to string.
Definition: sys_vars.h:705
bool check_update_type(Item_result type)
Definition: sys_vars.h:1163
int find_set(REP_SETS *sets, REP_SET *find)
Definition: mysqltest.cc:11121
Sys_var_session_special_double(const char *name_arg, const char *comment, int flag_args, CMD_LINE getopt, double min_val, double max_val, uint, PolyLock *lock, enum binlog_status_enum binlog_status_arg, on_check_function on_check_func, session_special_update_function update_func_arg, session_special_read_double_function read_func_arg, const char *substitute=0)
Definition: sys_vars.h:1754
static const int MAX_TEXT_LENGTH
The maximal length of the textual representation of a SID, not including the terminating &#39;\0&#39;...
Definition: rpl_gtid.h:958
Session_sysvar_resource_manager session_sysvar_res_mgr
Definition: sql_class.h:3904
Class for gtid_next.
Definition: sys_vars.h:2093
bool time_zone_used
Definition: sql_class.h:2332
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:409
bool do_check(THD *, set_var *)
Definition: sys_vars.h:2256
const uchar * session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:1778
const uchar * session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:2126
static struct st_mysql_daemon plugin
Definition: test_services_host_application_signal.cc:130
Definition: status_var.h:39
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:803
virtual const uchar * session_value_ptr(THD *, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:895
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:1729
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:448
LEX_CSTRING proxy_user() const
Getter method for member m_proxy_user.
Definition: sql_security_ctx.cc:1024
Sys_var_integer< ulonglong, GET_ULL, SHOW_LONGLONG, false > Sys_var_ulonglong
Definition: sys_vars.h:309
Sys_var_struct(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, void *def_val, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0, int parse_flag=PARSE_NORMAL)
Definition: sys_vars.h:1896
DBUG_VOID_RETURN
Definition: dbug_analyze.cc:151
char * c_ptr()
Definition: sql_string.h:243
bool is_readonly() const
Definition: set_var.h:246
virtual const uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:2268
char *
Definition: udf_registration_types.h:41
void my_free(void *ptr)
Frees the memory pointed by the ptr.
Definition: my_memory.cc:81
#define DBUG_EXPLAIN(buf, len)
Definition: my_dbug.h:184
The class for test_flags (core_file for now).
Definition: sys_vars.h:1187
The class for SET variables - variables taking zero or more values from the given list...
Definition: sys_vars.h:1350
bool check_update_type(Item_result type)
Definition: sys_vars.h:1022
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1155
const uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:1948
The class for keycache_* variables.
Definition: sys_vars.h:1044
KEY_CACHE * dflt_key_cache
Definition: mf_keycache.cc:207
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1770
void saved_value_to_string(THD *, set_var *, char *)
This function converts value stored in save_result to string.
Definition: sys_vars.h:891
Definition: sys_vars.h:866
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 saved_value_to_string(THD *, set_var *, char *)
This function converts value stored in save_result to string.
Definition: sys_vars.h:1777
bool check_update_type(Item_result type)
Definition: sys_vars.h:840
#define GET_NO_ARG
Definition: my_getopt.h:41
longlong getopt_ll_limit_value(longlong, const struct my_option *, bool *fix)
Definition: my_getopt.cc:1105
virtual bool session_update(THD *thd, set_var *var)
This function sets the session variable thd->variables.transaction_isolation to reflect changes to @s...
Definition: sys_vars.cc:4562
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
void global_save_default(THD *, set_var *)
save the global default value of the variable in var
Definition: sys_vars.h:890
arg_type
Definition: mysqltest.cc:1287
ulonglong ulonglong_value
for all integer, set, enum sysvars
Definition: set_var.h:393
Sys_var_enum(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, const char *values[], uint def_val, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0)
Definition: sys_vars.h:382
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
Sys_var_gtid_executed(const char *name_arg, const char *comment_arg)
Definition: sys_vars.h:2279
bool check_update_type(Item_result type)
Definition: sys_vars.h:2029
T * max_var_ptr()
Definition: sys_vars.h:296
Definition: set_var.h:107
union THD::@97 sys_var_tmp
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:1320
#define DBUG_EXECUTE_IF(keyword, a1)
Definition: my_dbug.h:155
ulonglong max_of_int_range(int var_type)
Maximum possible value for an integer GET_* variable type.
Definition: my_getopt.cc:1078
static const int OWNED_SIDNO_ANONYMOUS
Definition: sql_class.h:3326
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:1169
The class for boolean variables - a variant of ENUM variables with the fixed list of values of { OFF ...
Definition: sys_vars.h:430
bool session_update(THD *, set_var *)
Definition: sys_vars.h:660
char * mem_strdup(const char *str)
Definition: sql_class.h:315
uint alias_count
The number of elements of aliases (computed in the constructor).
Definition: sys_vars.h:731
#define GET_DOUBLE
Definition: my_getopt.h:54
void session_save_default(THD *thd, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:281
keycache_update_function keycache_update
Definition: sys_vars.h:1045
bool session_update(THD *, set_var *)
Definition: sys_vars.h:2313
const uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:1838
This struct represents a specification of a GTID for a statement to be executed: either "AUTOMATIC"...
Definition: rpl_gtid.h:3621
set_var_base descendant for assignments to the system variables.
Definition: set_var.h:386
#define longlong10_to_str(A, B, C)
Definition: m_string.h:291
strcpy(retval, s)
const uchar * session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:1671
virtual bool session_update(THD *thd, set_var *var)
This function sets the session variable thd->variables.transaction_read_only to reflect changes to @s...
Definition: sys_vars.cc:4631
Sys_var_keycache(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, ulonglong min_val, ulonglong max_val, ulonglong def_val, uint block_size, PolyLock *lock, enum binlog_status_enum binlog_status_arg, on_check_function on_check_func, keycache_update_function on_update_func, const char *substitute=0)
Definition: sys_vars.h:1048
Sys_var_binlog_encryption(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, bool def_val, PolyLock *lock, enum binlog_status_enum binlog_status_arg, on_check_function on_check_func)
Definition: sys_vars.h:2470
const char * alias
Definition: sys_vars.h:496
struct System_variables max_system_variables
Definition: mysqld.cc:1313
wrapper to hide a mutex and an rwlock under a common interface
Definition: sys_vars_shared.h:49
bool session_update(THD *, set_var *var)
Definition: sys_vars.h:990
Definition: sys_vars.h:2452
const char * fixup_command_line(const char *value_str)
Because of limitations in the command-line parsing library, the value given on the command-line canno...
Definition: sys_vars.h:599
bool do_check(THD *thd, set_var *var)
Definition: sys_vars.h:1273
const uchar * session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:1330
bool throw_bounds_warning(THD *thd, const char *name, bool fixed, bool is_unsigned, longlong v)
Throw warning (error in STRICT mode) if value for variable needed bounding.
Definition: set_var.cc:517
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
#define DBUG_PRINT(keyword, arglist)
Definition: my_dbug.h:165
void saved_value_to_string(THD *thd, set_var *var, char *def_val)
This function converts value stored in save_result to string.
Definition: sys_vars.h:1326
void saved_value_to_string(THD *, set_var *var, char *def_val)
This function converts value stored in save_result to string.
Definition: sys_vars.h:2009
void saved_value_to_string(THD *, set_var *var, char *def_val)
This function converts value stored in save_result to string.
Definition: sys_vars.h:1936
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:1999
This file includes constants used by all storage engines.
double(* session_special_read_double_function)(THD *thd)
Definition: sys_vars.h:1748
char * set_to_string(THD *thd, LEX_STRING *result, ulonglong set, const char *lib[], bool quoted)
Definition: strfunc.cc:266
int flags
or&#39;ed flag_enum values
Definition: set_var.h:144
The class for string variables.
Definition: sys_vars.h:753
char * strmake(const char *str, size_t size) const
Definition: sql_class.h:316
KEY_CACHE * create_key_cache(const char *name, size_t length)
Definition: keycaches.cc:74
Class representing the tx_read_only system variable for setting default transaction access mode...
Definition: sys_vars.h:2060
size_t to_string(char *buf, bool need_lock=false, const String_format *string_format=nullptr) const
Formats this Gtid_set as a string and saves in a given buffer.
Definition: rpl_gtid_set.cc:780
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:453
#define DBUG_ASSERT(A)
Definition: my_dbug.h:183
A small wrapper class to pass getopt arguments as a pair to the Sys_var_* constructors.
Definition: sys_vars.h:162
Definition: status_var.h:36
Definition: status_var.h:35
bool do_check(THD *, set_var *var)
Definition: sys_vars.h:338
#define keycache_var_ptr(KC, OFF)
Definition: sys_vars.h:1028
bool global_update(THD *thd, set_var *var)
Definition: sys_vars.cc:5974
#define GLOBAL_VAR(X)
Definition: sys_vars.h:104
const uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:1871
bool opt_bin_log
Definition: mysqld.cc:986
Sys_var_proxy_user(const char *name_arg, const char *comment, enum charset_enum is_os_charset_arg)
Definition: sys_vars.h:868
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
const uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:1544
Sys_var_multi_enum(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, const ALIAS aliases_arg[], uint value_count_arg, uint def_val, uint command_line_no_value_arg, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0, int parse_flag=PARSE_NORMAL)
Enumerated type system variable.
Definition: sys_vars.h:545
Sys_var_charptr(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, enum charset_enum is_os_charset_arg, const char *def_val, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0, int parse_flag=PARSE_NORMAL)
Definition: sys_vars.h:755
const uchar * session_value_ptr(THD *, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:1944
#define DBUG_ENTER(a)
Definition: my_dbug.h:135
static const char * bool_values[3]
Definition: sys_vars.h:153
bool global_update(THD *, set_var *)
Definition: sys_vars.h:672
LEX_STRING string_value
for Sys_var_charptr and others
Definition: set_var.h:397
enum get_opt_arg_type arg_type
Definition: sys_vars.h:164
void global_save_default(THD *, set_var *)
save the global default value of the variable in var
Definition: sys_vars.h:1832
LEX_CSTRING default_key_cache_base
Definition: keycaches.cc:63
USER_RESOURCES user_resources
Definition: sql_connect.h:94
const uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:2351
bool do_check(THD *, set_var *)
Definition: sys_vars.h:2124
bool global_update(THD *thd, set_var *var)
Definition: sys_vars.cc:4102
const uchar * session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:1537
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:406
uint test_flags
Definition: mysqld.cc:1124
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:1166
LEX_CSTRING external_user() const
Getter method for member m_external_user.
Definition: sql_security_ctx.h:423
bool check_update_type(Item_result type)
Definition: sys_vars.h:1941
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1654
Definition: set_var.h:112
flag_enum
Definition: set_var.h:106
bool check_update_type(Item_result)
Definition: sys_vars.h:892
const uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:1737
int32 get_anonymous_ownership_count()
Return the number of clients that hold anonymous ownership.
Definition: rpl_gtid.h:2711
enum enum_mysql_show_type SHOW_TYPE
Definition: set_var.h:68
void unlock()
Release the lock (whether it is a write or read lock).
Definition: rpl_gtid.h:473
bool(* keycache_update_function)(THD *, KEY_CACHE *, ptrdiff_t, ulonglong)
Definition: sys_vars.h:1030
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:998
void saved_value_to_string(THD *, set_var *var, char *def_val)
This function converts value stored in save_result to string.
Definition: sys_vars.h:836
const uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:2025
ptrdiff_t offset
offset to the value from global_system_variables
Definition: set_var.h:149
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.
bool do_check(THD *thd, set_var *var)
Definition: sys_vars.h:1469
charset_enum
Definition: sys_vars.h:151
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:191
#define my_plugin_lock_by_name(A, B, C)
Definition: sql_plugin.h:164
bool check_update_type(Item_result type)
Definition: sys_vars.h:280
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:1665
size_t length
Definition: mysql_lex_string.h:41
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:1004
virtual bool global_update(THD *thd, set_var *var)
Definition: sys_vars.cc:3728
The class for read-only variables that show whether a particular feature is supported by the server...
Definition: sys_vars.h:1799
double
Definition: udf_registration_types.h:42
virtual const uchar * session_value_ptr(THD *, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:908
Class for @session.gtid_purged.
Definition: sys_vars.h:2299
void session_save_default(THD *, set_var *)
save the session default value of the variable in var
Definition: sys_vars.h:2318
void saved_value_to_string(THD *, set_var *var, char *def_val)
This function converts value stored in save_result to string.
Definition: sys_vars.h:464
Header for compiler-dependent features.
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:397
Definition: sys_vars.h:151
const uchar * session_value_ptr(THD *, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:415
Sys_var_integer< uint, GET_UINT, SHOW_INT, false > Sys_var_uint
Definition: sys_vars.h:304
virtual const String * get_name() const =0
Because of constness of String returned by get_name() time zone name have to be already zeroended to ...
int scope() const
Definition: set_var.h:244
const uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:1429
Sys_var_integer< ulong, GET_ULONG, SHOW_LONG, false > Sys_var_ulong
Definition: sys_vars.h:305
The class for variables that store time zones.
Definition: sys_vars.h:1964
The class for flagset variables - a variant of SET that allows in-place editing (turning on/off indiv...
Definition: sys_vars.h:1253
#define GET_ASK_ADDR
Definition: my_getopt.h:68
bool validate_string(const CHARSET_INFO *cs, const char *str, size_t length, size_t *valid_length, bool *length_error)
Check if an input byte sequence is a valid character string of a given charset
Definition: sql_string.cc:1186
virtual bool global_update(THD *thd, set_var *var)=0
unsigned int uint
Definition: uca-dump.cc:29
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:402
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.cc:3762
void session_save_default(THD *thd, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:457
long long int longlong
Definition: my_inttypes.h:73
"protected" interface to sys_var - server configuration variables.
const uint value_count
The number of allowed numeric values.
Definition: sys_vars.h:727
#define MYF(v)
Definition: my_inttypes.h:124
Sys_var_transaction_read_only(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, bool def_val, PolyLock *lock, enum binlog_status_enum binlog_status_arg, on_check_function on_check_func)
Definition: sys_vars.h:2062
virtual void global_save_default(THD *thd, set_var *var)=0
save the global default value of the variable in var
Definition: status_var.h:54
Gtid owned_gtid
The GTID of the currently owned transaction.
Definition: sql_class.h:3324
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:908
LEX_CSTRING lex_cstring() const
Definition: sql_string.h:267
Definition: status_var.h:49
const uchar * session_value_ptr(THD *, THD *, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:2375
Definition: sys_vars.h:495
Sys_var_external_user(const char *name_arg, const char *comment_arg, enum charset_enum is_os_charset_arg)
Definition: sys_vars.h:903
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:1775
bool do_check(THD *thd, set_var *var)
Definition: sys_vars.h:779
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:272
MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_latin1
Definition: ctype-latin1.cc:358
ulonglong bitmask
Definition: sys_vars.h:1627
Sid_map * global_sid_map
Definition: mysqld.cc:1584
bool do_check(THD *, set_var *)
Definition: sys_vars.h:877
void saved_value_to_string(THD *, set_var *, char *)
This function converts value stored in save_result to string.
Definition: sys_vars.h:2123
bool in_init
Definition: keycache.h:128
Security_context * security_context() const
Definition: sql_class.h:1079
#define NON_PERSIST
Definition: sys_vars.h:130
virtual const uchar * session_value_ptr(THD *, THD *, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:2264
virtual String * val_str(String *str)=0
#define global_var(TYPE)
Definition: sys_vars.h:141
bool session_update(THD *, set_var *)
Definition: sys_vars.h:1823
#define READ_ONLY
Definition: sys_vars.h:124
Helper class for variables that take values from a TYPELIB.
Definition: sys_vars.h:315
bool check_update_type(Item_result type)
Definition: sys_vars.h:657
bool do_check(THD *thd, set_var *var)
Definition: sys_vars.h:206
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1724
const uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:1017
on_update_function on_update
Definition: set_var.h:151
uchar * global_var_ptr()
Definition: set_var.cc:342
Sys_var_max_user_conn(const char *name_arg, const char *comment, int, ptrdiff_t off, size_t size, CMD_LINE getopt, uint min_val, uint max_val, uint def_val, uint block_size, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0)
Definition: sys_vars.h:1217
CMD_LINE(enum get_opt_arg_type getopt_arg_type, int getopt_id=0)
Definition: sys_vars.h:165
sys_var_chain all_sys_vars
Definition: set_var.cc:112
Definition: sys_vars.h:151
Definition: my_getopt.h:78
Common header for many mysys elements.
session_special_read_double_function read_func
Definition: sys_vars.h:1750
Item * value
the expression that provides the new value of the variable
Definition: set_var.h:389
static bool is_valid(const char *text)
Returns true if the given string is a valid specification of a Gtid_set, false otherwise.
Definition: rpl_gtid_set.cc:580
Definition: sys_vars.h:2438
size_t length
Definition: mysql_lex_string.h:36
Sys_var_integer< long, GET_LONG, SHOW_SIGNED_LONG, true > Sys_var_long
Definition: sys_vars.h:310
virtual bool global_update(THD *thd, set_var *var) override
Definition: sys_vars.cc:6559
#define MAX_SET(X)
Definition: sys_vars.h:1237
A variant of enum where:
Definition: sys_vars.h:493
char * flagset_to_string(THD *thd, LEX_STRING *result, ulonglong set, const char *lib[])
Definition: strfunc.cc:299
bool update(char **var, char *val, size_t val_len)
Frees the old alloced memory, memdup()&#39;s the given val to a new memory address & updated the session ...
Definition: sys_vars_resource_mgr.cc:72
Represents a set of GTIDs.
Definition: rpl_gtid.h:1302
The class for the max_user_connections.
Definition: sys_vars.h:1215
void saved_value_to_string(THD *, set_var *, char *)
This function converts value stored in save_result to string.
Definition: sys_vars.h:1731
Definition: typelib.h:34
void saved_value_to_string(THD *, set_var *var, char *)
This function converts value stored in save_result to string.
Definition: sys_vars.h:2326
void session_save_default(THD *, set_var *)
save the session default value of the variable in var
Definition: sys_vars.h:2253
const uchar * session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:2387
Definition: sql_error.h:58
#define my_strcasecmp(s, a, b)
Definition: m_ctype.h:685
int id
Definition: sys_vars.h:163
session_special_update_function update_func
Definition: sys_vars.h:1751
#define DBUG_EXPLAIN_INITIAL(buf, len)
Definition: my_dbug.h:185
Generic class for variables for storing entities that are internally represented as structures...
Definition: sys_vars.h:93
SHOW_COMP_OPTION
Definition: sql_const.h:375
Abstract base class for read-only variables (global or session) of string type where the value is gen...
Definition: sys_vars.h:2232
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:1658
void saved_value_to_string(THD *, set_var *, char *)
This function converts value stored in save_result to string.
Definition: sys_vars.h:1833
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:1323
#define GET_SET
Definition: my_getopt.h:53
Definition: sys_vars.h:2468
const uchar * session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:1732
double getopt_ulonglong2double(ulonglong)
Returns the double value which corresponds to the given raw representation.
Definition: my_getopt.cc:164
size_t get_string_length(const String_format *string_format=nullptr) const
Returns the length of the output from to_string.
Definition: rpl_gtid_set.cc:889
Sys_var_flagset(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, const char *values[], ulonglong def_val, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0)
Definition: sys_vars.h:1255
bool(* session_special_update_function)(THD *thd, set_var *var)
Definition: sys_vars.h:1747
const Owned_gtids * get_owned_gtids() const
Return a pointer to the Owned_gtids that contains the owned gtids.
Definition: rpl_gtid.h:3051
The class for variables that have a special meaning for a session, such as @timestamp or @rnd_seed1...
Definition: sys_vars.h:1700
Definition: sql_connect.h:69
static const int MAX_TEXT_LENGTH
Definition: rpl_gtid.h:3672
const uchar * session_value_ptr(THD *, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:2012
bool global_update(THD *, set_var *)
Definition: sys_vars.h:1827
Class for @global.gtid_executed.
Definition: sys_vars.h:2277
virtual bool check_update_type(Item_result type)=0
bool global_update(THD *, set_var *)
Definition: sys_vars.h:2111
const uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:1335
Definition: sys_vars.h:2381
static const int OWNED_SIDNO_GTID_SET
Definition: sql_class.h:3325
void session_save_default(THD *, set_var *)
save the session default value of the variable in var
Definition: sys_vars.h:685
#define NO_CMD_LINE
Definition: sys_vars.h:113
Sys_var_lexstring(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, enum charset_enum is_os_charset_arg, const char *def_val, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0)
Definition: sys_vars.h:929
Declarations for the Debug Sync Facility.
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
double getopt_double_limit_value(double num, const struct my_option *optp, bool *fix)
Definition: my_getopt.cc:1212
void saved_value_to_string(THD *, set_var *, char *)
This function converts value stored in save_result to string.
Definition: sys_vars.h:2255
Definition: my_getopt.h:78
Sys_var_integer(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, T min_val, T max_val, T def_val, uint block_size, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0, int parse_flag=PARSE_NORMAL)
Definition: sys_vars.h:184
const uchar * session_value_ptr(THD *, THD *, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:709
Sys_var_enforce_gtid_consistency(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, const ALIAS aliases[], const uint value_count, uint def_val, uint command_line_no_value, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0)
Definition: sys_vars.h:2454
static enum SHOW_COMP_OPTION dummy_
Definition: sys_vars.h:1877
bool do_check(THD *, set_var *)
Definition: sys_vars.h:1920
static const char * pname[]
Definition: uca-dump.cc:275
Sys_var_tz(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, Time_zone **def_val, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0, int parse_flag=PARSE_NORMAL)
Definition: sys_vars.h:1966
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:1417
const char * fixup_enforce_gtid_consistency_command_line(char *value_arg)
Definition: sys_vars.cc:5822
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:2006
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:1929
void saved_value_to_string(THD *, set_var *var, char *def_val)
This function converts value stored in save_result to string.
Definition: sys_vars.h:1008
#define GET_ENUM
Definition: my_getopt.h:52
Time_zone * my_tz_find(THD *thd, const String *name)
Definition: tztime.cc:2098
virtual const uchar * global_value_ptr(THD *thd, LEX_STRING *base)
Definition: set_var.cc:334
bool do_check(THD *thd, set_var *var)
Definition: sys_vars.h:979
@session.dbug and @global.dbug variables.
Definition: sys_vars.h:964
size_t count
Definition: typelib.h:35
#define my_plugin_lock(A, B)
Definition: sql_plugin.h:166
session_special_read_function read_func
Definition: sys_vars.h:1704
void global_save_default(THD *, set_var *)
save the global default value of the variable in var
Definition: sys_vars.h:1730
rpl_sidno sidno
SIDNO of this Gtid.
Definition: rpl_gtid.h:926
intptr_t intptr
Definition: my_inttypes.h:63
Sys_var_bit(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, ulonglong bitmask_arg, bool def_val, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0)
Definition: sys_vars.h:1637
virtual bool session_update(THD *thd, set_var *var)=0
bool global_update(THD *, set_var *)
Definition: sys_vars.h:885
void session_save_default(THD *thd, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:1512
sys_var * var
system variable to be updated
Definition: set_var.h:388
Represents the set of GTIDs that are owned by some thread.
Definition: rpl_gtid.h:2264
size_t get_max_string_length() const
Return an upper bound on the length of the string representation of this Owned_gtids.
Definition: rpl_gtid.h:2359
const USER_CONN * get_user_connect() const
Definition: sql_class.h:1994
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1406
plugin_ref plugin
for Sys_var_plugin
Definition: set_var.h:395
static const char * get_name(void)
Definition: stdin_check.c:28
const CHARSET_INFO * charset() const
Definition: sql_string.h:232
A better implementation of the UNIX ctype(3) library.
void * alloc(size_t size)
Definition: sql_class.h:300
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1921
KEY_CACHE * get_key_cache(const LEX_CSTRING *cache_name)
Definition: keycaches.cc:68
bool do_check(THD *thd, set_var *var)
Definition: sys_vars.h:2330
Definition: sys_vars.h:901
ulonglong(* session_special_read_function)(THD *thd)
Definition: sys_vars.h:1702
Checkable_rwlock * global_sid_lock
Protects Gtid_state. See comment above gtid_state for details.
Definition: mysqld.cc:1583
Sys_var_have_func(const char *name_arg, const char *comment, enum SHOW_COMP_OPTION(*func)(THD *))
Construct a new variable.
Definition: sys_vars.h:1861
bool do_check(THD *thd, set_var *var)
Definition: sys_vars.h:1147
#define GET_BOOL
Definition: my_getopt.h:42
const string value("\alue\)
Similar to Sys_var_session_special, but with double storage.
Definition: sys_vars.h:1746
session_special_update_function update_func
Definition: sys_vars.h:1705
Gtid_set * get_gtid_set() const
Return NULL if this is NULL, otherwise return the Gtid_set.
Definition: rpl_gtid.h:2223
bool bool_value
Definition: sql_class.h:2372
void saved_value_to_string(THD *, set_var *var, char *def_val)
This function converts value stored in save_result to string.
Definition: sys_vars.h:1532
virtual const uchar * global_value_ptr(THD *thd, LEX_STRING *base)
Definition: sys_vars.h:853
const uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:2424
bool check_update_type(Item_result type)
Definition: sys_vars.h:2125
#define DBUG_SET(a1)
Definition: my_dbug.h:175
Sys_var_dbug(const char *name_arg, const char *comment, int flag_args, CMD_LINE getopt, const char *def_val, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0, int parse_flag=PARSE_NORMAL)
Definition: sys_vars.h:966
void saved_value_to_string(THD *, set_var *var, char *def_val)
This function converts value stored in save_result to string.
Definition: sys_vars.h:1668
const char * ptr() const
Definition: sql_string.h:241
const SHOW_TYPE show_val_type
what value_ptr() returns for sql_show.cc
Definition: set_var.h:146
#define DBUG_SET_INITIAL(a1)
Definition: my_dbug.h:176
Holds information about a Gtid_set.
Definition: rpl_gtid.h:2217
A subclass of Sys_var_have to return dynamic values.
Definition: sys_vars.h:1852
#define id
Definition: lexyy.cc:961
Key cache variable structures.
#define STRING_BUFFER_USUAL_SIZE
Definition: sql_const.h:130
LEX_CSTRING to_lex_cstring(const LEX_STRING &s)
Definition: sql_string.h:620
void saved_value_to_string(THD *thd, set_var *var, char *def_val)
This function converts value stored in save_result to string.
Definition: sys_vars.h:1420
The class for ENUM variables - variables that take one value from a fixed list of values...
Definition: sys_vars.h:380
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:1316
static std::string to_string(const LEX_STRING &str)
Definition: lex_string.h:44
bool global_update(THD *thd, set_var *var)
Definition: sys_vars.cc:3712
virtual Item_result result_type() const
Definition: item.h:989
const char * name
Definition: typelib.h:36
Sys_var_version(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, enum charset_enum is_os_charset_arg, const char *def_val)
Definition: sys_vars.h:845
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:1508
void plugin_unlock(THD *thd, plugin_ref plugin)
Definition: sql_plugin.cc:1235
bool global_update(THD *, set_var *)
Definition: sys_vars.h:1771
TYPELIB typelib
Definition: sys_vars.h:317
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:1414
Sys_var_charptr_func(const char *name_arg, const char *comment, flag_enum flag_arg)
Definition: sys_vars.h:2234
my_ulonglong find_set_from_flags(const TYPELIB *lib, size_t default_name, my_ulonglong cur_set, my_ulonglong default_set, const char *str, unsigned int length, const char **err_pos, unsigned int *err_len)
Parse and apply a set of flag assingments.
Definition: typelib.cc:311
bool global_update(THD *, set_var *)
Definition: sys_vars.h:1725
bool do_check(THD *thd, set_var *var)
Definition: sys_vars.h:1981
bool do_check(THD *, set_var *)
Definition: sys_vars.h:1819
Sys_var_plugin(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, int plugin_type_arg, char **def_val, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0, int parse_flag=PARSE_NORMAL)
Definition: sys_vars.h:1452
const char * show_comp_option_name[]
Definition: mysqld.cc:849
void global_save_default(THD *, set_var *)
save the global default value of the variable in var
Definition: sys_vars.h:2254
Sys_var_have(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0, int parse_flag=PARSE_NORMAL)
Definition: sys_vars.h:1801
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:698
ulonglong ulonglong_value
Definition: sql_class.h:2375
uint test_flag_mask
Definition: sys_vars.h:1190
#define DBUG_POP()
Definition: my_dbug.h:174
void cleanup()
All the cleanup procedures should be performed here.
Definition: sys_vars.h:774
rpl_sid owned_sid
For convenience, this contains the SID component of the GTID stored in owned_gtid.
Definition: sql_class.h:3332
Sys_var_integer template is used to generate Sys_var_* classes for variables that represent the value...
Definition: sys_vars.h:95
void push_warning_printf(THD *thd, Sql_condition::enum_severity_level severity, uint code, const char *format,...)
Push the warning to error list if there is still room in the list.
Definition: sql_error.cc:691
unsigned long ulong
Definition: my_inttypes.h:48
Gtid_state * gtid_state
Global state of GTIDs.
Definition: mysqld.cc:1585
const uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:2282
double double_value
for Sys_var_double
Definition: set_var.h:394
#define false
Definition: config_static.h:43
Sys_var_gtid_purged(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t, CMD_LINE getopt, const char *def_val, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0, int parse_flag=PARSE_NORMAL)
Definition: sys_vars.h:2301
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
bool global_update(THD *thd, set_var *var)
Definition: sys_vars.h:945
LEX_STRING base
for structured variables, like keycache_name.variable_name
Definition: set_var.h:401
const Gtid_set * get_executed_gtids() const
Definition: rpl_gtid.h:3035
size_t length() const
Definition: sql_string.h:233
bool do_check(THD *, set_var *var)
Definition: sys_vars.h:629
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: sys_vars.h:1227
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1312
virtual bool do_check(THD *thd, set_var *var)=0
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
Class representing the &#39;transaction_isolation&#39; system variable.
Definition: sys_vars.h:2038
#define MAX_TIME_ZONE_NAME_LENGTH
Maximum length of time zone name that we support (Time zone name is char(64) in db).
Definition: sql_const.h:288
bool test_flag_value
Definition: sys_vars.h:1189
void global_save_default(THD *, set_var *)
save the global default value of the variable in var
Definition: sys_vars.h:1776
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:1925
Sys_var_session_special(const char *name_arg, const char *comment, int flag_args, CMD_LINE getopt, ulonglong min_val, ulonglong max_val, uint block_size, PolyLock *lock, enum binlog_status_enum binlog_status_arg, on_check_function on_check_func, session_special_update_function update_func_arg, session_special_read_function read_func_arg, const char *substitute=0)
Definition: sys_vars.h:1708
bool(* on_check_function)(sys_var *self, THD *thd, set_var *var)
Definition: set_var.h:140
void session_save_default(THD *, set_var *)
save the session default value of the variable in var
Definition: sys_vars.h:1003
#define comment
Definition: lexyy.cc:959
void saved_value_to_string(THD *, set_var *var, char *def_val)
This function converts value stored in save_result to string.
Definition: sys_vars.h:1172
Sys_var_bool(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, CMD_LINE getopt, bool def_val, PolyLock *lock=0, enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG, on_check_function on_check_func=0, on_update_function on_update_func=0, const char *substitute=0, int parse_flag=PARSE_NORMAL)
Definition: sys_vars.h:432
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:777
size_t my_fcvt(double x, int precision, char *to, bool *error)
Converts a given floating point number to a zero-terminated string representation using the &#39;f&#39; forma...
Definition: dtoa.cc:205
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:1410
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:1662
Definition: set_var.h:90
Sys_var_gtid_owned(const char *name_arg, const char *comment_arg)
Definition: sys_vars.h:2383
ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp, bool *fix)
Definition: my_getopt.cc:1172
Log error(cerr, "ERROR")
#define session_var(THD, TYPE)
Definition: sys_vars.h:140