MySQL  8.0.16
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, 2018, 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) {
283  static_cast<ulonglong>(*(T *)global_value_ptr(thd, 0));
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  uchar *session_value_ptr(THD *, THD *target_thd, LEX_STRING *) {
416  return (uchar *)typelib.type_names[session_var(target_thd, ulong)];
417  }
420  }
421 };
422 
423 /**
424  The class for boolean variables - a variant of ENUM variables
425  with the fixed list of values of { OFF , ON }
426 
427  Backing store: bool
428 */
430  public:
432  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
433  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, bool def_val,
434  PolyLock *lock = 0,
435  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
436  on_check_function on_check_func = 0,
437  on_update_function on_update_func = 0, const char *substitute = 0,
438  int parse_flag = PARSE_NORMAL)
439  : Sys_var_typelib(name_arg, comment, flag_args, off, getopt, SHOW_MY_BOOL,
440  bool_values, def_val, lock, binlog_status_arg,
441  on_check_func, on_update_func, substitute, parse_flag) {
442  option.var_type = GET_BOOL;
443  global_var(bool) = def_val;
444  DBUG_ASSERT(getopt.arg_type == OPT_ARG || getopt.id == -1);
445  DBUG_ASSERT(size == sizeof(bool));
446  }
447  bool session_update(THD *thd, set_var *var) {
448  session_var(thd, bool) =
449  static_cast<bool>(var->save_result.ulonglong_value);
450  return false;
451  }
452  bool global_update(THD *, set_var *var) {
453  global_var(bool) = static_cast<bool>(var->save_result.ulonglong_value);
454  return false;
455  }
456  void session_save_default(THD *thd, set_var *var) {
458  static_cast<ulonglong>(*(bool *)global_value_ptr(thd, 0));
459  }
461  var->save_result.ulonglong_value = option.def_value;
462  }
463  void saved_value_to_string(THD *, set_var *var, char *def_val) {
465  }
466 };
467 
468 /**
469  A variant of enum where:
470  - Each value may have multiple enum-like aliases.
471  - Instances of the class can specify different default values for
472  the cases:
473  - User specifies the command-line option without a value (i.e.,
474  --option, not --option=value).
475  - User does not specify a command-line option at all.
476 
477  This exists mainly to allow extending a variable that once was
478  boolean in a GA version, into an enumeration type. Booleans accept
479  multiple aliases (0=off=false, 1=on=true), but Sys_var_enum does
480  not, so we could not use Sys_var_enum without breaking backward
481  compatibility. Moreover, booleans default to false if option is not
482  given, and true if option is given without value.
483 
484  This is *incompatible* with boolean in the following sense:
485  'SELECT @@variable' returns 0 or 1 for a boolean, whereas this class
486  (similar to enum) returns the textual form. (Note that both boolean,
487  enum, and this class return the textual form in SHOW VARIABLES and
488  SELECT * FROM information_schema.variables).
489 
490  See enforce_gtid_consistency for an example of how this can be used.
491 */
492 class Sys_var_multi_enum : public sys_var {
493  public:
494  struct ALIAS {
495  const char *alias;
497  };
498 
499  /**
500  Enumerated type system variable.
501 
502  @param name_arg See sys_var::sys_var()
503 
504  @param comment See sys_var::sys_var()
505 
506  @param flag_args See sys_var::sys_var()
507 
508  @param off See sys_var::sys_var()
509 
510  @param size See sys_var::sys_var()
511 
512  @param getopt See sys_var::sys_var()
513 
514  @param aliases_arg Array of ALIASes, indicating which textual
515  values map to which number. Should be terminated with an ALIAS
516  having member variable alias set to NULL. The first
517  `value_count_arg' elements must map to 0, 1, etc; these will be
518  used when the value is displayed. Remaining elements may appear
519  in arbitrary order.
520 
521  @param value_count_arg The number of allowed integer values.
522 
523  @param def_val The default value if no command line option is
524  given. This must be a valid index into the aliases_arg array, but
525  it does not have to be less than value_count. The corresponding
526  alias will be used in mysqld --help to show the default value.
527 
528  @param command_line_no_value_arg The default value if a command line
529  option is given without a value ('--command-line-option' without
530  '=VALUE'). This must be less than value_count_arg.
531 
532  @param lock See sys_var::sys_var()
533 
534  @param binlog_status_arg See sys_var::sys_var()
535 
536  @param on_check_func See sys_var::sys_var()
537 
538  @param on_update_func See sys_var::sys_var()
539 
540  @param substitute See sys_var::sys_var()
541 
542  @param parse_flag See sys_var::sys_var()
543  */
545  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
546  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt,
547  const ALIAS aliases_arg[], uint value_count_arg, uint def_val,
548  uint command_line_no_value_arg, PolyLock *lock = 0,
549  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
550  on_check_function on_check_func = 0,
551  on_update_function on_update_func = 0, const char *substitute = 0,
552  int parse_flag = PARSE_NORMAL)
553  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
554  getopt.arg_type, SHOW_CHAR, def_val, lock, binlog_status_arg,
555  on_check_func, on_update_func, substitute, parse_flag),
556  value_count(value_count_arg),
557  aliases(aliases_arg),
558  command_line_no_value(command_line_no_value_arg) {
561  DBUG_ASSERT(def_val < alias_count);
562 
563  option.var_type = GET_STR;
564  option.value = &command_line_value;
565  option.def_value = (intptr)aliases[def_val].alias;
566 
567  global_var(ulong) = aliases[def_val].number;
568 
569  DBUG_ASSERT(getopt.arg_type == OPT_ARG || getopt.id == -1);
570  DBUG_ASSERT(size == sizeof(ulong));
571  }
572 
573  /**
574  Return the numeric value for a given alias string, or -1 if the
575  string is not a valid alias.
576  */
577  int find_value(const char *text) {
578  for (uint i = 0; aliases[i].alias != NULL; i++)
579  if (my_strcasecmp(system_charset_info, aliases[i].alias, text) == 0)
580  return aliases[i].number;
581  return -1;
582  }
583 
584  /**
585  Because of limitations in the command-line parsing library, the
586  value given on the command-line cannot be automatically copied to
587  the global value. Instead, inheritants of this class should call
588  this function from mysqld.cc:mysqld_get_one_option.
589 
590  @param value_str Pointer to the value specified on the command
591  line (as in --option=VALUE).
592 
593  @retval NULL Success.
594 
595  @retval non-NULL Pointer to the invalid string that was used as
596  argument.
597  */
598  const char *fixup_command_line(const char *value_str) {
599  DBUG_ENTER("Sys_var_multi_enum::fixup_command_line");
600  char *end = NULL;
601  long value;
602 
603  // User passed --option (not --option=value).
604  if (value_str == NULL) {
606  goto end;
607  }
608 
609  // Get textual value.
610  value = find_value(value_str);
611  if (value != -1) goto end;
612 
613  // Get numeric value.
614  value = strtol(value_str, &end, 10);
615  // found a number and nothing else?
616  if (end > value_str && *end == '\0')
617  // value is in range?
618  if (value >= 0 && (longlong)value < (longlong)value_count) goto end;
619 
620  // Not a valid value.
621  DBUG_RETURN(value_str);
622 
623  end:
625  DBUG_RETURN(NULL);
626  }
627 
628  bool do_check(THD *, set_var *var) {
629  DBUG_ENTER("Sys_var_multi_enum::do_check");
630  char buff[STRING_BUFFER_USUAL_SIZE];
631  String str(buff, sizeof(buff), system_charset_info), *res;
632  if (var->value->result_type() == STRING_RESULT) {
633  res = var->value->val_str(&str);
634  if (!res) DBUG_RETURN(true);
635 
636  /* Check if the value is a valid string. */
637  size_t valid_len;
638  bool len_error;
639  if (validate_string(system_charset_info, res->ptr(), res->length(),
640  &valid_len, &len_error))
641  DBUG_RETURN(true);
642 
643  int value = find_value(res->ptr());
644  if (value == -1) DBUG_RETURN(true);
646  } else {
647  longlong value = var->value->val_int();
648  if (value < 0 || value >= (longlong)value_count)
649  DBUG_RETURN(true);
650  else
652  }
653 
654  DBUG_RETURN(false);
655  }
657  return type != INT_RESULT && type != STRING_RESULT;
658  }
660  DBUG_ENTER("Sys_var_multi_enum::session_update");
661  DBUG_ASSERT(0);
662  /*
663  Currently not used: uncomment if this class is used as a base for
664  a session variable.
665 
666  session_var(thd, ulong)=
667  static_cast<ulong>(var->save_result.ulonglong_value);
668  */
669  DBUG_RETURN(false);
670  }
671  bool global_update(THD *, set_var *) {
672  DBUG_ENTER("Sys_var_multi_enum::global_update");
673  DBUG_ASSERT(0);
674  /*
675  Currently not used: uncomment if this some inheriting class does
676  not override..
677 
678  ulong val=
679  static_cast<ulong>(var->save_result.ulonglong_value);
680  global_var(ulong)= val;
681  */
682  DBUG_RETURN(false);
683  }
685  DBUG_ENTER("Sys_var_multi_enum::session_save_default");
686  DBUG_ASSERT(0);
687  /*
688  Currently not used: uncomment if this class is used as a base for
689  a session variable.
690 
691  int value= find_value((char *)option.def_value);
692  DBUG_ASSERT(value != -1);
693  var->save_result.ulonglong_value= value;
694  */
696  }
698  DBUG_ENTER("Sys_var_multi_enum::global_save_default");
699  int value = find_value((char *)option.def_value);
700  DBUG_ASSERT(value != -1);
703  }
704  void saved_value_to_string(THD *, set_var *var, char *def_val) {
706  }
707 
709  DBUG_ENTER("Sys_var_multi_enum::session_value_ptr");
710  DBUG_ASSERT(0);
711  /*
712  Currently not used: uncomment if this class is used as a base for
713  a session variable.
714 
715  DBUG_RETURN((uchar*)aliases[session_var(target_thd, ulong)].alias);
716  */
717  DBUG_RETURN(0);
718  }
720  DBUG_ENTER("Sys_var_multi_enum::global_value_ptr");
722  }
723 
724  private:
725  /// The number of allowed numeric values.
727  /// Array of all textual aliases.
728  const ALIAS *aliases;
729  /// The number of elements of aliases (computed in the constructor).
731 
732  /**
733  Pointer to the value set by the command line (set by the command
734  line parser, copied to the global value in fixup_command_line()).
735  */
736  const char *command_line_value;
738 };
739 
740 /**
741  The class for string variables. The string can be in character_set_filesystem
742  or in character_set_system. The string can be allocated with my_malloc()
743  or not. The state of the initial value is specified in the constructor,
744  after that it's managed automatically. The value of NULL is supported.
745 
746  Class specific constructor arguments:
747  enum charset_enum is_os_charset_arg
748 
749  Backing store: char*
750 
751 */
752 class Sys_var_charptr : public sys_var {
753  public:
755  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
756  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt,
757  enum charset_enum is_os_charset_arg, const char *def_val,
758  PolyLock *lock = 0,
759  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
760  on_check_function on_check_func = 0,
761  on_update_function on_update_func = 0, const char *substitute = 0,
762  int parse_flag = PARSE_NORMAL)
763  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
764  getopt.arg_type, SHOW_CHAR_PTR, (intptr)def_val, lock,
765  binlog_status_arg, on_check_func, on_update_func, substitute,
766  parse_flag) {
767  is_os_charset = is_os_charset_arg == IN_FS_CHARSET;
768  option.var_type = (flags & ALLOCATED) ? GET_STR_ALLOC : GET_STR;
769  global_var(const char *) = def_val;
770  DBUG_ASSERT(size == sizeof(char *));
771  }
772 
773  void cleanup() {
774  if (flags & ALLOCATED) my_free(global_var(char *));
775  flags &= ~ALLOCATED;
776  }
777 
778  bool do_check(THD *thd, set_var *var) {
780  String str(buff, sizeof(buff), charset(thd));
781  String str2(buff2, sizeof(buff2), charset(thd)), *res;
782 
783  if (!(res = var->value->val_str(&str)))
784  var->save_result.string_value.str = 0;
785  else {
786  size_t unused;
787  if (String::needs_conversion(res->length(), res->charset(), charset(thd),
788  &unused)) {
789  uint errors;
790  str2.copy(res->ptr(), res->length(), res->charset(), charset(thd),
791  &errors);
792  res = &str2;
793  }
795  thd->strmake(res->ptr(), res->length());
796  var->save_result.string_value.length = res->length();
797  }
798 
799  return false;
800  }
801 
802  bool session_update(THD *thd, set_var *var) {
803  char *new_val = var->save_result.string_value.str;
804  size_t new_val_len = var->save_result.string_value.length;
805  char *ptr = ((char *)&thd->variables + offset);
806 
807  return thd->session_sysvar_res_mgr.update((char **)ptr, new_val,
808  new_val_len);
809  }
810 
811  bool global_update(THD *thd, set_var *var);
812 
814  char *ptr = (char *)(intptr)option.def_value;
815  var->save_result.string_value.str = ptr;
816  var->save_result.string_value.length = ptr ? strlen(ptr) : 0;
817  }
818 
820  char *ptr = (char *)(intptr)option.def_value;
821  /*
822  TODO: default values should not be null. Fix all and turn this into an
823  assert.
824  Do that only for NON_PERSIST READ_ONLY variables since the rest use
825  the NULL value as a flag that SET .. = DEFAULT was issued and hence
826  it should not be alterned.
827  */
831  ? ptr
832  : const_cast<char *>("");
833  var->save_result.string_value.length = ptr ? strlen(ptr) : 0;
834  }
835  void saved_value_to_string(THD *, set_var *var, char *def_val) {
836  memcpy(def_val, var->save_result.string_value.str,
838  }
840 };
841 
843  public:
844  Sys_var_version(const char *name_arg, const char *comment, int flag_args,
845  ptrdiff_t off, size_t size, CMD_LINE getopt,
846  enum charset_enum is_os_charset_arg, const char *def_val)
847  : Sys_var_charptr(name_arg, comment, flag_args, off, size, getopt,
848  is_os_charset_arg, def_val) {}
849 
851 
852  virtual uchar *global_value_ptr(THD *thd, LEX_STRING *base) {
854 
855  DBUG_EXECUTE_IF("alter_server_version_str", {
856  static const char *altered_value = "some-other-version";
857  uchar *altered_value_ptr = reinterpret_cast<uchar *>(&altered_value);
858  value = altered_value_ptr;
859  });
860 
861  return value;
862  }
863 };
864 
865 class Sys_var_proxy_user : public sys_var {
866  public:
867  Sys_var_proxy_user(const char *name_arg, const char *comment,
868  enum charset_enum is_os_charset_arg)
869  : sys_var(&all_sys_vars, name_arg, comment,
872  PARSE_NORMAL) {
873  is_os_charset = is_os_charset_arg == IN_FS_CHARSET;
874  option.var_type = GET_STR;
875  }
876  bool do_check(THD *, set_var *) {
877  DBUG_ASSERT(false);
878  return true;
879  }
881  DBUG_ASSERT(false);
882  return true;
883  }
884  bool global_update(THD *, set_var *) {
885  DBUG_ASSERT(false);
886  return false;
887  }
890  void saved_value_to_string(THD *, set_var *, char *) { DBUG_ASSERT(false); }
891  bool check_update_type(Item_result) { return true; }
892 
893  protected:
894  virtual uchar *session_value_ptr(THD *, THD *target_thd, LEX_STRING *) {
895  const char *proxy_user = target_thd->security_context()->proxy_user().str;
896  return proxy_user[0] ? (uchar *)proxy_user : NULL;
897  }
898 };
899 
901  public:
902  Sys_var_external_user(const char *name_arg, const char *comment_arg,
903  enum charset_enum is_os_charset_arg)
904  : Sys_var_proxy_user(name_arg, comment_arg, is_os_charset_arg) {}
905 
906  protected:
907  virtual uchar *session_value_ptr(THD *, THD *target_thd, LEX_STRING *) {
908  LEX_CSTRING external_user = target_thd->security_context()->external_user();
909  return external_user.length ? (uchar *)external_user.str : NULL;
910  }
911 };
912 
913 /**
914  The class for string variables. Useful for strings that aren't necessarily
915  \0-terminated. Otherwise the same as Sys_var_charptr.
916 
917  Class specific constructor arguments:
918  enum charset_enum is_os_charset_arg
919 
920  Backing store: LEX_STRING
921 
922  @note
923  Behaves exactly as Sys_var_charptr, only the backing store is different.
924 */
926  public:
928  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
929  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt,
930  enum charset_enum is_os_charset_arg, const char *def_val,
931  PolyLock *lock = 0,
932  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
933  on_check_function on_check_func = 0,
934  on_update_function on_update_func = 0, const char *substitute = 0)
935  : Sys_var_charptr(name_arg, comment, flag_args, off, sizeof(char *),
936  getopt, is_os_charset_arg, def_val, lock,
937  binlog_status_arg, on_check_func, on_update_func,
938  substitute) {
939  global_var(LEX_STRING).length = strlen(def_val);
940  DBUG_ASSERT(size == sizeof(LEX_STRING));
941  *const_cast<SHOW_TYPE *>(&show_val_type) = SHOW_LEX_STRING;
942  }
943  bool global_update(THD *thd, set_var *var) {
944  if (Sys_var_charptr::global_update(thd, var)) return true;
946  return false;
947  }
948 };
949 
950 #ifndef DBUG_OFF
951 /**
952  @@session.dbug and @@global.dbug variables.
953 
954  @@dbug variable differs from other variables in one aspect:
955  if its value is not assigned in the session, it "points" to the global
956  value, and so when the global value is changed, the change
957  immediately takes effect in the session.
958 
959  This semantics is intentional, to be able to debug one session from
960  another.
961 */
962 class Sys_var_dbug : public sys_var {
963  public:
965  const char *name_arg, const char *comment, int flag_args, CMD_LINE getopt,
966  const char *def_val, PolyLock *lock = 0,
967  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
968  on_check_function on_check_func = 0,
969  on_update_function on_update_func = 0, const char *substitute = 0,
970  int parse_flag = PARSE_NORMAL)
971  : sys_var(&all_sys_vars, name_arg, comment, flag_args, 0, getopt.id,
972  getopt.arg_type, SHOW_CHAR, (intptr)def_val, lock,
973  binlog_status_arg, on_check_func, on_update_func, substitute,
974  parse_flag) {
975  option.var_type = GET_NO_ARG;
976  }
977  bool do_check(THD *thd, set_var *var) {
978  char buff[STRING_BUFFER_USUAL_SIZE];
979  String str(buff, sizeof(buff), system_charset_info), *res;
980 
981  if (!(res = var->value->val_str(&str)))
982  var->save_result.string_value.str = const_cast<char *>("");
983  else
985  thd->strmake(res->ptr(), res->length());
986  return false;
987  }
988  bool session_update(THD *, set_var *var) {
989  const char *val = var->save_result.string_value.str;
990  if (!var->value)
991  DBUG_POP();
992  else
993  DBUG_SET(val);
994  return false;
995  }
996  bool global_update(THD *, set_var *var) {
997  const char *val = var->save_result.string_value.str;
998  DBUG_SET_INITIAL(val);
999  return false;
1000  }
1003  char *ptr = (char *)(intptr)option.def_value;
1004  var->save_result.string_value.str = ptr;
1005  }
1006  void saved_value_to_string(THD *, set_var *var, char *def_val) {
1007  memcpy(def_val, var->save_result.string_value.str,
1009  }
1010  uchar *session_value_ptr(THD *running_thd, THD *, LEX_STRING *) {
1011  char buf[256];
1012  DBUG_EXPLAIN(buf, sizeof(buf));
1013  return (uchar *)running_thd->mem_strdup(buf);
1014  }
1016  char buf[256];
1017  DBUG_EXPLAIN_INITIAL(buf, sizeof(buf));
1018  return (uchar *)thd->mem_strdup(buf);
1019  }
1021 };
1022 #endif
1023 
1024 #define KEYCACHE_VAR(X) \
1025  sys_var::GLOBAL, offsetof(KEY_CACHE, X), sizeof(((KEY_CACHE *)0)->X)
1026 #define keycache_var_ptr(KC, OFF) (((uchar *)(KC)) + (OFF))
1027 #define keycache_var(KC, OFF) (*(ulonglong *)keycache_var_ptr(KC, OFF))
1028 typedef bool (*keycache_update_function)(THD *, KEY_CACHE *, ptrdiff_t,
1029  ulonglong);
1030 
1031 /**
1032  The class for keycache_* variables. Supports structured names,
1033  keycache_name.variable_name.
1034 
1035  Class specific constructor arguments:
1036  everything derived from Sys_var_ulonglong
1037 
1038  Backing store: ulonglong
1039 
1040  @note these variables can be only GLOBAL
1041 */
1044 
1045  public:
1046  Sys_var_keycache(const char *name_arg, const char *comment, int flag_args,
1047  ptrdiff_t off, size_t size, CMD_LINE getopt,
1048  ulonglong min_val, ulonglong max_val, ulonglong def_val,
1049  uint block_size, PolyLock *lock,
1050  enum binlog_status_enum binlog_status_arg,
1051  on_check_function on_check_func,
1052  keycache_update_function on_update_func,
1053  const char *substitute = 0)
1055  name_arg, comment, flag_args, -1, /* offset, see base class CTOR */
1056  size, getopt, min_val, max_val, def_val, block_size, lock,
1057  binlog_status_arg, on_check_func, 0, substitute),
1058  keycache_update(on_update_func) {
1059  offset = off; /* Remember offset in KEY_CACHE */
1060  option.var_type |= GET_ASK_ADDR;
1061  option.value = (uchar **)1; // crash me, please
1062  keycache_var(dflt_key_cache, off) = def_val;
1063  DBUG_ASSERT(scope() == GLOBAL);
1064  }
1065  bool global_update(THD *thd, set_var *var) {
1066  ulonglong new_value = var->save_result.ulonglong_value;
1067  LEX_STRING *base_name = &var->base;
1068  KEY_CACHE *key_cache;
1069 
1070  if (base_name != NULL && base_name->str)
1072  ER_WARN_DEPRECATED_SYNTAX,
1073  "%s.%s syntax "
1074  "is deprecated and will be removed in a "
1075  "future release",
1076  base_name->str, name.str);
1077 
1078  /* If no basename, assume it's for the key cache named 'default' */
1079  if (!base_name->length) base_name = &default_key_cache_base;
1080 
1081  key_cache = get_key_cache(base_name);
1082 
1083  if (!key_cache) { // Key cache didn't exists */
1084  if (!new_value) // Tried to delete cache
1085  return false; // Ok, nothing to do
1086  if (!(key_cache = create_key_cache(base_name->str, base_name->length)))
1087  return true;
1088  }
1089 
1090  /**
1091  Abort if some other thread is changing the key cache
1092  @todo This should be changed so that we wait until the previous
1093  assignment is done and then do the new assign
1094  */
1095  if (key_cache->in_init) return true;
1096 
1097  return keycache_update(thd, key_cache, offset, new_value);
1098  }
1100  if (base != NULL && base->str)
1102  ER_WARN_DEPRECATED_SYNTAX,
1103  "@@global.%s.%s syntax "
1104  "is deprecated and will be removed in a "
1105  "future release",
1106  base->str, name.str);
1107 
1108  KEY_CACHE *key_cache = get_key_cache(base);
1109  if (!key_cache) key_cache = &zero_key_cache;
1110  return keycache_var_ptr(key_cache, offset);
1111  }
1112 };
1113 
1114 /**
1115  The class for floating point variables
1116 
1117  Class specific constructor arguments: min, max
1118 
1119  Backing store: double
1120 */
1121 class Sys_var_double : public sys_var {
1122  public:
1124  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
1125  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, double min_val,
1126  double max_val, double def_val, PolyLock *lock = 0,
1127  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1128  on_check_function on_check_func = 0,
1129  on_update_function on_update_func = 0, const char *substitute = 0,
1130  int parse_flag = PARSE_NORMAL)
1131  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
1132  getopt.arg_type, SHOW_DOUBLE,
1133  (longlong)getopt_double2ulonglong(def_val), lock,
1134  binlog_status_arg, on_check_func, on_update_func, substitute,
1135  parse_flag) {
1136  option.var_type = GET_DOUBLE;
1137  option.min_value = (longlong)getopt_double2ulonglong(min_val);
1138  option.max_value = (longlong)getopt_double2ulonglong(max_val);
1139  global_var(double) = getopt_ulonglong2double(option.def_value);
1140  DBUG_ASSERT(min_val <= max_val);
1141  DBUG_ASSERT(min_val <= def_val);
1142  DBUG_ASSERT(max_val >= def_val);
1143  DBUG_ASSERT(size == sizeof(double));
1144  }
1145  bool do_check(THD *thd, set_var *var) {
1146  bool fixed;
1147  double v = var->value->val_real();
1148  var->save_result.double_value =
1149  getopt_double_limit_value(v, &option, &fixed);
1150 
1151  return throw_bounds_warning(thd, name.str, fixed, v);
1152  }
1153  bool session_update(THD *thd, set_var *var) {
1154  session_var(thd, double) = var->save_result.double_value;
1155  return false;
1156  }
1157  bool global_update(THD *, set_var *var) {
1158  global_var(double) = var->save_result.double_value;
1159  return false;
1160  }
1162  return type != INT_RESULT && type != REAL_RESULT && type != DECIMAL_RESULT;
1163  }
1165  var->save_result.double_value = global_var(double);
1166  }
1169  }
1170  void saved_value_to_string(THD *, set_var *var, char *def_val) {
1171  my_fcvt(var->save_result.double_value, 6, def_val, NULL);
1172  }
1173 };
1174 
1175 /**
1176  The class for @c test_flags (core_file for now).
1177  It's derived from Sys_var_bool.
1178 
1179  Class specific constructor arguments:
1180  Caller need not pass in a variable as we make up the value on the
1181  fly, that is, we derive it from the global test_flags bit vector.
1182 
1183  Backing store: bool
1184 */
1186  private:
1189 
1190  public:
1191  Sys_var_test_flag(const char *name_arg, const char *comment, uint mask)
1192  : Sys_var_bool(name_arg, comment,
1195  test_flag_mask = mask;
1196  }
1199  return (uchar *)&test_flag_value;
1200  }
1201 };
1202 
1203 /**
1204  The class for the @c max_user_connections.
1205  It's derived from Sys_var_uint, but non-standard session value
1206  requires a new class.
1207 
1208  Class specific constructor arguments:
1209  everything derived from Sys_var_uint
1210 
1211  Backing store: uint
1212 */
1214  public:
1216  const char *name_arg, const char *comment, int, ptrdiff_t off,
1217  size_t size, CMD_LINE getopt, uint min_val, uint max_val, uint def_val,
1218  uint block_size, PolyLock *lock = 0,
1219  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1220  on_check_function on_check_func = 0,
1221  on_update_function on_update_func = 0, const char *substitute = 0)
1222  : Sys_var_uint(name_arg, comment, SESSION, off, size, getopt, min_val,
1223  max_val, def_val, block_size, lock, binlog_status_arg,
1224  on_check_func, on_update_func, substitute) {}
1225  uchar *session_value_ptr(THD *running_thd, THD *target_thd,
1226  LEX_STRING *base) {
1227  const USER_CONN *uc = target_thd->get_user_connect();
1228  if (uc && uc->user_resources.user_conn)
1229  return (uchar *)&(uc->user_resources.user_conn);
1230  return global_value_ptr(running_thd, base);
1231  }
1232 };
1233 
1234 // overflow-safe (1 << X)-1
1235 #define MAX_SET(X) ((((1ULL << ((X)-1)) - 1) << 1) | 1)
1236 
1237 /**
1238  The class for flagset variables - a variant of SET that allows in-place
1239  editing (turning on/off individual bits). String representations looks like
1240  a "flag=val,flag=val,...". Example: @@optimizer_switch
1241 
1242  Class specific constructor arguments:
1243  char* values[] - 0-terminated list of strings of valid values
1244 
1245  Backing store: ulonglong
1246 
1247  @note
1248  the last value in the values[] array should
1249  *always* be the string "default".
1250 */
1252  public:
1254  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
1255  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, const char *values[],
1256  ulonglong def_val, PolyLock *lock = 0,
1257  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1258  on_check_function on_check_func = 0,
1259  on_update_function on_update_func = 0, const char *substitute = 0)
1260  : Sys_var_typelib(name_arg, comment, flag_args, off, getopt, SHOW_CHAR,
1261  values, def_val, lock, binlog_status_arg, on_check_func,
1262  on_update_func, substitute) {
1263  option.var_type = GET_FLAGSET;
1264  global_var(ulonglong) = def_val;
1265  DBUG_ASSERT(typelib.count > 1);
1266  DBUG_ASSERT(typelib.count <= 65);
1267  DBUG_ASSERT(def_val < MAX_SET(typelib.count));
1268  DBUG_ASSERT(strcmp(values[typelib.count - 1], "default") == 0);
1269  DBUG_ASSERT(size == sizeof(ulonglong));
1270  }
1271  bool do_check(THD *thd, set_var *var) {
1272  char buff[STRING_BUFFER_USUAL_SIZE];
1273  String str(buff, sizeof(buff), system_charset_info), *res;
1274  ulonglong default_value, current_value;
1275  if (var->type == OPT_GLOBAL) {
1276  default_value = option.def_value;
1277  current_value = global_var(ulonglong);
1278  } else {
1279  default_value = global_var(ulonglong);
1280  current_value = session_var(thd, ulonglong);
1281  }
1282 
1283  if (var->value->result_type() == STRING_RESULT) {
1284  if (!(res = var->value->val_str(&str)))
1285  return true;
1286  else {
1287  const char *error;
1288  uint error_len;
1289 
1291  &typelib, typelib.count, current_value, default_value, res->ptr(),
1292  static_cast<uint>(res->length()), &error, &error_len);
1293  if (error) {
1294  ErrConvString err(error, error_len, res->charset());
1295  my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name.str, err.ptr());
1296  return true;
1297  }
1298  }
1299  } else {
1300  longlong tmp = var->value->val_int();
1301  if ((tmp < 0 && !var->value->unsigned_flag) ||
1302  (ulonglong)tmp > MAX_SET(typelib.count))
1303  return true;
1304  else
1305  var->save_result.ulonglong_value = tmp;
1306  }
1307 
1308  return false;
1309  }
1310  bool session_update(THD *thd, set_var *var) {
1312  return false;
1313  }
1314  bool global_update(THD *, set_var *var) {
1316  return false;
1317  }
1320  }
1322  var->save_result.ulonglong_value = option.def_value;
1323  }
1324  void saved_value_to_string(THD *thd, set_var *var, char *def_val) {
1325  strcpy(def_val, flagset_to_string(thd, 0, var->save_result.ulonglong_value,
1326  typelib.type_names));
1327  }
1328  uchar *session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *) {
1329  return (uchar *)flagset_to_string(
1330  running_thd, 0, session_var(target_thd, ulonglong), typelib.type_names);
1331  }
1333  return (uchar *)flagset_to_string(thd, 0, global_var(ulonglong),
1335  }
1336 };
1337 
1338 /**
1339  The class for SET variables - variables taking zero or more values
1340  from the given list. Example: @@sql_mode
1341 
1342  Class specific constructor arguments:
1343  char* values[] - 0-terminated list of strings of valid values
1344 
1345  Backing store: ulonglong
1346 */
1348  public:
1350  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
1351  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, const char *values[],
1352  ulonglong def_val, PolyLock *lock = 0,
1353  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1354  on_check_function on_check_func = 0,
1355  on_update_function on_update_func = 0, const char *substitute = 0)
1356  : Sys_var_typelib(name_arg, comment, flag_args, off, getopt, SHOW_CHAR,
1357  values, def_val, lock, binlog_status_arg, on_check_func,
1358  on_update_func, substitute) {
1359  option.var_type = GET_SET;
1360  global_var(ulonglong) = def_val;
1361  DBUG_ASSERT(typelib.count > 0);
1362  DBUG_ASSERT(typelib.count <= 64);
1363  DBUG_ASSERT(def_val < MAX_SET(typelib.count));
1364  DBUG_ASSERT(size == sizeof(ulonglong));
1365  }
1366  bool do_check(THD *, set_var *var) {
1367  char buff[STRING_BUFFER_USUAL_SIZE];
1368  String str(buff, sizeof(buff), system_charset_info), *res;
1369 
1370  if (var->value->result_type() == STRING_RESULT) {
1371  if (!(res = var->value->val_str(&str)))
1372  return true;
1373  else {
1374  char *error;
1375  uint error_len;
1376  bool not_used;
1377 
1379  find_set(&typelib, res->ptr(), static_cast<uint>(res->length()),
1380  NULL, &error, &error_len, &not_used);
1381  /*
1382  note, we only issue an error if error_len > 0.
1383  That is even while empty (zero-length) values are considered
1384  errors by find_set(), these errors are ignored here
1385  */
1386  if (error_len) {
1387  ErrConvString err(error, error_len, res->charset());
1388  my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name.str, err.ptr());
1389  return true;
1390  }
1391  }
1392  } else {
1393  longlong tmp = var->value->val_int();
1394  if ((tmp < 0 && !var->value->unsigned_flag) ||
1395  (ulonglong)tmp > MAX_SET(typelib.count))
1396  return true;
1397  else
1398  var->save_result.ulonglong_value = tmp;
1399  }
1400 
1401  return false;
1402  }
1403  bool session_update(THD *thd, set_var *var) {
1405  return false;
1406  }
1407  bool global_update(THD *, set_var *var) {
1409  return false;
1410  }
1413  }
1415  var->save_result.ulonglong_value = option.def_value;
1416  }
1417  void saved_value_to_string(THD *thd, set_var *var, char *def_val) {
1418  strcpy(def_val, set_to_string(thd, 0, var->save_result.ulonglong_value,
1419  typelib.type_names));
1420  }
1421  uchar *session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *) {
1422  return (uchar *)set_to_string(
1423  running_thd, 0, session_var(target_thd, ulonglong), typelib.type_names);
1424  }
1426  return (uchar *)set_to_string(thd, 0, global_var(ulonglong),
1428  }
1429 };
1430 
1431 /**
1432  The class for variables which value is a plugin.
1433  Example: @@default_storage_engine
1434 
1435  Class specific constructor arguments:
1436  int plugin_type_arg (for example MYSQL_STORAGE_ENGINE_PLUGIN)
1437 
1438  Backing store: plugin_ref
1439 
1440  @note
1441  these variables don't support command-line equivalents, any such
1442  command-line options should be added manually to my_long_options in mysqld.cc
1443 */
1444 class Sys_var_plugin : public sys_var {
1446 
1447  public:
1449  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
1450  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, int plugin_type_arg,
1451  char **def_val, PolyLock *lock = 0,
1452  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1453  on_check_function on_check_func = 0,
1454  on_update_function on_update_func = 0, const char *substitute = 0,
1455  int parse_flag = PARSE_NORMAL)
1456  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
1457  getopt.arg_type, SHOW_CHAR, (intptr)def_val, lock,
1458  binlog_status_arg, on_check_func, on_update_func, substitute,
1459  parse_flag),
1460  plugin_type(plugin_type_arg) {
1461  option.var_type = GET_STR;
1462  DBUG_ASSERT(size == sizeof(plugin_ref));
1463  DBUG_ASSERT(getopt.id == -1); // force NO_CMD_LINE
1464  }
1465  bool do_check(THD *thd, set_var *var) {
1466  char buff[STRING_BUFFER_USUAL_SIZE];
1467  String str(buff, sizeof(buff), system_charset_info), *res;
1468 
1469  /* NULLs can't be used as a default storage engine */
1470  if (!(res = var->value->val_str(&str))) return true;
1471 
1472  const LEX_STRING pname = {const_cast<char *>(res->ptr()), res->length()};
1474 
1475  // special code for storage engines (e.g. to handle historical aliases)
1477  plugin = ha_resolve_by_name(thd, &pname, false);
1478  else {
1479  LEX_CSTRING pname_cstr = {pname.str, pname.length};
1480  plugin = my_plugin_lock_by_name(thd, pname_cstr, plugin_type);
1481  }
1482 
1483  if (!plugin) {
1484  // historically different error code
1486  ErrConvString err(res);
1487  my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), err.ptr());
1488  }
1489  return true;
1490  }
1491  var->save_result.plugin = plugin;
1492  return false;
1493  }
1494  void do_update(plugin_ref *valptr, plugin_ref newval) {
1495  plugin_ref oldval = *valptr;
1496  if (oldval != newval) {
1497  *valptr = my_plugin_lock(NULL, &newval);
1498  plugin_unlock(NULL, oldval);
1499  }
1500  }
1501  bool session_update(THD *thd, set_var *var) {
1503  return false;
1504  }
1505  bool global_update(THD *, set_var *var) {
1507  return false;
1508  }
1509  void session_save_default(THD *thd, set_var *var) {
1511  var->save_result.plugin = my_plugin_lock(thd, &plugin);
1512  }
1513  void global_save_default(THD *thd, set_var *var) {
1514  LEX_STRING pname;
1515  char **default_value = reinterpret_cast<char **>(option.def_value);
1516  pname.str = *default_value;
1517  pname.length = strlen(pname.str);
1518 
1521  plugin = ha_resolve_by_name(thd, &pname, false);
1522  else {
1523  LEX_CSTRING pname_cstr = {pname.str, pname.length};
1524  plugin = my_plugin_lock_by_name(thd, pname_cstr, plugin_type);
1525  }
1527 
1528  var->save_result.plugin = my_plugin_lock(thd, &plugin);
1529  }
1530  void saved_value_to_string(THD *, set_var *var, char *def_val) {
1531  strncpy(def_val, plugin_name(var->save_result.plugin)->str,
1533  }
1535  uchar *session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *) {
1536  plugin_ref plugin = session_var(target_thd, plugin_ref);
1537  return (uchar *)(plugin ? running_thd->strmake(plugin_name(plugin)->str,
1539  : 0);
1540  }
1543  return (uchar *)(plugin ? thd->strmake(plugin_name(plugin)->str,
1545  : 0);
1546  }
1547 };
1548 
1549 #if defined(ENABLED_DEBUG_SYNC)
1550 /**
1551  The class for @@debug_sync session-only variable
1552 */
1553 class Sys_var_debug_sync : public sys_var {
1554  public:
1555  Sys_var_debug_sync(
1556  const char *name_arg, const char *comment, int flag_args, CMD_LINE getopt,
1557  const char *def_val, PolyLock *lock = 0,
1558  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1559  on_check_function on_check_func = 0,
1560  on_update_function on_update_func = 0, const char *substitute = 0,
1561  int parse_flag = PARSE_NORMAL)
1562  : sys_var(&all_sys_vars, name_arg, comment, flag_args, 0, getopt.id,
1563  getopt.arg_type, SHOW_CHAR, (intptr)def_val, lock,
1564  binlog_status_arg, on_check_func, on_update_func, substitute,
1565  parse_flag) {
1566  DBUG_ASSERT(scope() == ONLY_SESSION);
1567  option.var_type = GET_NO_ARG;
1568  }
1569  bool do_check(THD *thd, set_var *var) {
1570  char buff[STRING_BUFFER_USUAL_SIZE];
1571  String str(buff, sizeof(buff), system_charset_info), *res;
1572 
1573  if (!(res = var->value->val_str(&str)))
1574  var->save_result.string_value.str = const_cast<char *>("");
1575  else
1577  thd->strmake(res->ptr(), res->length());
1578  return false;
1579  }
1580  bool session_update(THD *thd, set_var *var) {
1581  return debug_sync_update(thd, var->save_result.string_value.str);
1582  }
1583  bool global_update(THD *, set_var *) {
1584  DBUG_ASSERT(false);
1585  return true;
1586  }
1587  void session_save_default(THD *, set_var *var) {
1588  var->save_result.string_value.str = const_cast<char *>("");
1589  var->save_result.string_value.length = 0;
1590  }
1591  void global_save_default(THD *, set_var *) { DBUG_ASSERT(false); }
1592  void saved_value_to_string(THD *, set_var *, char *) { DBUG_ASSERT(false); }
1593  uchar *session_value_ptr(THD *running_thd, THD *, LEX_STRING *) {
1594  return debug_sync_value_ptr(running_thd);
1595  }
1597  DBUG_ASSERT(false);
1598  return 0;
1599  }
1600  bool check_update_type(Item_result type) { return type != STRING_RESULT; }
1601 };
1602 #endif /* defined(ENABLED_DEBUG_SYNC) */
1603 
1604 /**
1605  The class for bit variables - a variant of boolean that stores the value
1606  in a bit.
1607 
1608  Class specific constructor arguments:
1609  ulonglong bitmask_arg - the mask for the bit to set in the ulonglong
1610  backing store
1611 
1612  Backing store: ulonglong
1613 
1614  @note
1615  This class supports the "reverse" semantics, when the value of the bit
1616  being 0 corresponds to the value of variable being set. To activate it
1617  use REVERSE(bitmask) instead of simply bitmask in the constructor.
1618 
1619  @note
1620  variables of this class cannot be set from the command line as
1621  my_getopt does not support bits.
1622 */
1626  void set(uchar *ptr, ulonglong value) {
1627  if ((value != 0) ^ reverse_semantics)
1628  (*(ulonglong *)ptr) |= bitmask;
1629  else
1630  (*(ulonglong *)ptr) &= ~bitmask;
1631  }
1632 
1633  public:
1635  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
1636  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt,
1637  ulonglong bitmask_arg, bool def_val, PolyLock *lock = 0,
1638  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1639  on_check_function on_check_func = 0,
1640  on_update_function on_update_func = 0, const char *substitute = 0)
1641  : Sys_var_typelib(name_arg, comment, flag_args, off, getopt, SHOW_MY_BOOL,
1642  bool_values, def_val, lock, binlog_status_arg,
1643  on_check_func, on_update_func, substitute) {
1644  option.var_type = GET_BOOL;
1645  reverse_semantics = my_count_bits(bitmask_arg) > 1;
1646  bitmask = reverse_semantics ? ~bitmask_arg : bitmask_arg;
1647  set(global_var_ptr(), def_val);
1648  DBUG_ASSERT(getopt.id == -1); // force NO_CMD_LINE
1649  DBUG_ASSERT(size == sizeof(ulonglong));
1650  }
1651  bool session_update(THD *thd, set_var *var) {
1653  return false;
1654  }
1655  bool global_update(THD *, set_var *var) {
1657  return false;
1658  }
1661  }
1663  var->save_result.ulonglong_value = option.def_value;
1664  }
1665  void saved_value_to_string(THD *, set_var *var, char *def_val) {
1667  }
1668  uchar *session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *) {
1669  running_thd->sys_var_tmp.bool_value = static_cast<bool>(
1671  ((session_var(target_thd, ulonglong) & bitmask) != 0));
1672  return (uchar *)&running_thd->sys_var_tmp.bool_value;
1673  }
1675  thd->sys_var_tmp.bool_value = static_cast<bool>(
1677  return (uchar *)&thd->sys_var_tmp.bool_value;
1678  }
1679 };
1680 
1681 /**
1682  The class for variables that have a special meaning for a session,
1683  such as @@timestamp or @@rnd_seed1, their values typically cannot be read
1684  from SV structure, and a special "read" callback is provided.
1685 
1686  Class specific constructor arguments:
1687  everything derived from Sys_var_ulonglong
1688  session_special_read_function read_func_arg
1689 
1690  Backing store: ulonglong
1691 
1692  @note
1693  These variables are session-only, global or command-line equivalents
1694  are not supported as they're generally meaningless.
1695 */
1699 
1702 
1703  public:
1704  Sys_var_session_special(const char *name_arg, const char *comment,
1705  int flag_args, CMD_LINE getopt, ulonglong min_val,
1706  ulonglong max_val, uint block_size, PolyLock *lock,
1707  enum binlog_status_enum binlog_status_arg,
1708  on_check_function on_check_func,
1709  session_special_update_function update_func_arg,
1710  session_special_read_function read_func_arg,
1711  const char *substitute = 0)
1712  : Sys_var_ulonglong(name_arg, comment, flag_args, 0, sizeof(ulonglong),
1713  getopt, min_val, max_val, 0, block_size, lock,
1714  binlog_status_arg, on_check_func, 0, substitute),
1715  read_func(read_func_arg),
1716  update_func(update_func_arg) {
1718  DBUG_ASSERT(getopt.id == -1); // NO_CMD_LINE, because the offset is fake
1719  }
1720  bool session_update(THD *thd, set_var *var) { return update_func(thd, var); }
1722  DBUG_ASSERT(false);
1723  return true;
1724  }
1725  void session_save_default(THD *, set_var *var) { var->value = 0; }
1727  void saved_value_to_string(THD *, set_var *, char *) { DBUG_ASSERT(false); }
1728  uchar *session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *) {
1729  running_thd->sys_var_tmp.ulonglong_value = read_func(target_thd);
1730  return (uchar *)&running_thd->sys_var_tmp.ulonglong_value;
1731  }
1733  DBUG_ASSERT(false);
1734  return 0;
1735  }
1736 };
1737 
1738 /**
1739  Similar to Sys_var_session_special, but with double storage.
1740 */
1744 
1747 
1748  public:
1750  const char *name_arg, const char *comment, int flag_args, CMD_LINE getopt,
1751  double min_val, double max_val, uint, PolyLock *lock,
1752  enum binlog_status_enum binlog_status_arg,
1753  on_check_function on_check_func,
1754  session_special_update_function update_func_arg,
1756  const char *substitute = 0)
1757  : Sys_var_double(name_arg, comment, flag_args, 0, sizeof(double), getopt,
1758  min_val, max_val, 0.0, lock, binlog_status_arg,
1759  on_check_func, 0, substitute),
1760  read_func(read_func_arg),
1761  update_func(update_func_arg) {
1763  DBUG_ASSERT(getopt.id == -1); // NO_CMD_LINE, because the offset is fake
1764  }
1765  bool session_update(THD *thd, set_var *var) { return update_func(thd, var); }
1767  DBUG_ASSERT(false);
1768  return true;
1769  }
1770  void session_save_default(THD *, set_var *var) { var->value = 0; }
1772  void saved_value_to_string(THD *, set_var *, char *) { DBUG_ASSERT(false); }
1773  uchar *session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *) {
1774  running_thd->sys_var_tmp.double_value = read_func(target_thd);
1775  return (uchar *)&running_thd->sys_var_tmp.double_value;
1776  }
1778  DBUG_ASSERT(false);
1779  return 0;
1780  }
1781 };
1782 
1783 /**
1784  The class for read-only variables that show whether a particular
1785  feature is supported by the server. Example: have_compression
1786 
1787  Backing store: enum SHOW_COMP_OPTION
1788 
1789  @note
1790  These variables are necessarily read-only, only global, and have no
1791  command-line equivalent.
1792 */
1793 class Sys_var_have : public sys_var {
1794  public:
1796  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
1797  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, PolyLock *lock = 0,
1798  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1799  on_check_function on_check_func = 0,
1800  on_update_function on_update_func = 0, const char *substitute = 0,
1801  int parse_flag = PARSE_NORMAL)
1802  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
1803  getopt.arg_type, SHOW_CHAR, 0, lock, binlog_status_arg,
1804  on_check_func, on_update_func, substitute, parse_flag) {
1805  DBUG_ASSERT(scope() == GLOBAL);
1806  DBUG_ASSERT(getopt.id == -1);
1807  DBUG_ASSERT(lock == 0);
1808  DBUG_ASSERT(binlog_status_arg == VARIABLE_NOT_IN_BINLOG);
1810  DBUG_ASSERT(on_update == 0);
1811  DBUG_ASSERT(size == sizeof(enum SHOW_COMP_OPTION));
1812  }
1813  bool do_check(THD *, set_var *) {
1814  DBUG_ASSERT(false);
1815  return true;
1816  }
1818  DBUG_ASSERT(false);
1819  return true;
1820  }
1822  DBUG_ASSERT(false);
1823  return true;
1824  }
1827  void saved_value_to_string(THD *, set_var *, char *) {}
1829  DBUG_ASSERT(false);
1830  return 0;
1831  }
1834  }
1835  bool check_update_type(Item_result) { return false; }
1836 };
1837 
1838 /**
1839  A subclass of @ref Sys_var_have to return dynamic values
1840 
1841  All the usual restrictions for @ref Sys_var_have apply.
1842  But instead of reading a global variable it calls a function
1843  to return the value.
1844  */
1846  public:
1847  /**
1848  Construct a new variable.
1849 
1850  @param name_arg The name of the variable
1851  @param comment Explanation of what the variable does
1852  @param func The function to call when in need to read the global value
1853  */
1854  Sys_var_have_func(const char *name_arg, const char *comment,
1855  enum SHOW_COMP_OPTION (*func)(THD *))
1856  /*
1857  Note: it doesn't really matter what variable we use, as long as we are
1858  using one. So we use a local static dummy
1859  */
1860  : Sys_var_have(name_arg, comment,
1862  func_(func) {}
1863 
1865  return (uchar *)show_comp_option_name[func_(thd)];
1866  }
1867 
1868  protected:
1871 };
1872 /**
1873  Generic class for variables for storing entities that are internally
1874  represented as structures, have names, and possibly can be referred to by
1875  numbers. Examples: character sets, collations, locales,
1876 
1877  Backing store: void*
1878  @tparam Struct_type type of struct being wrapped
1879  @tparam Name_getter must provide Name_getter(Struct_type*).get_name()
1880 
1881  @note
1882  As every such a structure requires special treatment from my_getopt,
1883  these variables don't support command-line equivalents, any such
1884  command-line options should be added manually to my_long_options in mysqld.cc
1885 */
1886 template <typename Struct_type, typename Name_getter>
1887 class Sys_var_struct : public sys_var {
1888  public:
1890  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
1891  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, void *def_val,
1892  PolyLock *lock = 0,
1893  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1894  on_check_function on_check_func = 0,
1895  on_update_function on_update_func = 0, const char *substitute = 0,
1896  int parse_flag = PARSE_NORMAL)
1897  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
1898  getopt.arg_type, SHOW_CHAR, (intptr)def_val, lock,
1899  binlog_status_arg, on_check_func, on_update_func, substitute,
1900  parse_flag) {
1901  option.var_type = GET_STR;
1902  /*
1903  struct variables are special on the command line - often (e.g. for
1904  charsets) the name cannot be immediately resolved, but only after all
1905  options (in particular, basedir) are parsed.
1906 
1907  thus all struct command-line options should be added manually
1908  to my_long_options in mysqld.cc
1909  */
1910  DBUG_ASSERT(getopt.id == -1);
1911  DBUG_ASSERT(size == sizeof(void *));
1912  }
1913  bool do_check(THD *, set_var *) { return false; }
1914  bool session_update(THD *thd, set_var *var) {
1915  session_var(thd, const void *) = var->save_result.ptr;
1916  return false;
1917  }
1918  bool global_update(THD *, set_var *var) {
1919  global_var(const void *) = var->save_result.ptr;
1920  return false;
1921  }
1923  var->save_result.ptr = global_var(void *);
1924  }
1926  void **default_value = reinterpret_cast<void **>(option.def_value);
1927  var->save_result.ptr = *default_value;
1928  }
1929  void saved_value_to_string(THD *, set_var *var, char *def_val) {
1930  const Struct_type *ptr = (Struct_type *)var->save_result.ptr;
1931  if (ptr) strcpy(def_val, (char *)Name_getter(ptr).get_name());
1932  }
1934  return type != INT_RESULT && type != STRING_RESULT;
1935  }
1936  uchar *session_value_ptr(THD *, THD *target_thd, LEX_STRING *) {
1937  const Struct_type *ptr = session_var(target_thd, const Struct_type *);
1938  return ptr ? Name_getter(ptr).get_name() : nullptr;
1939  }
1941  const Struct_type *ptr = global_var(const Struct_type *);
1942  return ptr ? Name_getter(ptr).get_name() : nullptr;
1943  }
1944 };
1945 
1946 /**
1947  The class for variables that store time zones
1948 
1949  Backing store: Time_zone*
1950 
1951  @note
1952  Time zones cannot be supported directly by my_getopt, thus
1953  these variables don't support command-line equivalents, any such
1954  command-line options should be added manually to my_long_options in mysqld.cc
1955 */
1956 class Sys_var_tz : public sys_var {
1957  public:
1958  Sys_var_tz(const char *name_arg, const char *comment, int flag_args,
1959  ptrdiff_t off, size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt,
1960  Time_zone **def_val, PolyLock *lock = 0,
1961  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
1962  on_check_function on_check_func = 0,
1963  on_update_function on_update_func = 0, const char *substitute = 0,
1964  int parse_flag = PARSE_NORMAL)
1965  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
1966  getopt.arg_type, SHOW_CHAR, (intptr)def_val, lock,
1967  binlog_status_arg, on_check_func, on_update_func, substitute,
1968  parse_flag) {
1969  DBUG_ASSERT(getopt.id == -1);
1970  DBUG_ASSERT(size == sizeof(Time_zone *));
1971  }
1972  bool do_check(THD *thd, set_var *var) {
1973  char buff[MAX_TIME_ZONE_NAME_LENGTH];
1974  String str(buff, sizeof(buff), &my_charset_latin1);
1975  String *res = var->value->val_str(&str);
1976 
1977  if (!res) return true;
1978 
1979  if (!(var->save_result.time_zone = my_tz_find(thd, res))) {
1980  ErrConvString err(res);
1981  my_error(ER_UNKNOWN_TIME_ZONE, MYF(0), err.ptr());
1982  return true;
1983  }
1984  return false;
1985  }
1986  bool session_update(THD *thd, set_var *var) {
1987  session_var(thd, Time_zone *) = var->save_result.time_zone;
1988  return false;
1989  }
1990  bool global_update(THD *, set_var *var) {
1992  return false;
1993  }
1996  }
1998  var->save_result.time_zone = *(Time_zone **)(intptr)option.def_value;
1999  }
2000  void saved_value_to_string(THD *, set_var *var, char *def_val) {
2001  strcpy(def_val, (char *)var->save_result.time_zone->get_name()->ptr());
2002  }
2003  uchar *session_value_ptr(THD *, THD *target_thd, LEX_STRING *) {
2004  /*
2005  This is an ugly fix for replication: we don't replicate properly queries
2006  invoking system variables' values to update tables; but
2007  CONVERT_TZ(,,@@session.time_zone) is so popular that we make it
2008  replicable (i.e. we tell the binlog code to store the session
2009  timezone). If it's the global value which was used we can't replicate
2010  (binlog code stores session value only).
2011  */
2012  target_thd->time_zone_used = 1;
2013  return (uchar *)(session_var(target_thd, Time_zone *)->get_name()->ptr());
2014  }
2016  return (uchar *)(global_var(Time_zone *)->get_name()->ptr());
2017  }
2019 };
2020 
2021 /**
2022  Class representing the 'transaction_isolation' system variable. This
2023  variable can also be indirectly set using 'SET TRANSACTION ISOLATION
2024  LEVEL'.
2025 */
2026 
2028  public:
2029  Sys_var_transaction_isolation(const char *name_arg, const char *comment,
2030  int flag_args, ptrdiff_t off, size_t size,
2031  CMD_LINE getopt, const char *values[],
2032  uint def_val, PolyLock *lock,
2033  enum binlog_status_enum binlog_status_arg,
2034  on_check_function on_check_func)
2035  : Sys_var_enum(name_arg, comment, flag_args, off, size, getopt, values,
2036  def_val, lock, binlog_status_arg, on_check_func) {}
2037  virtual bool session_update(THD *thd, set_var *var);
2038 };
2039 
2040 /**
2041  Class representing the tx_read_only system variable for setting
2042  default transaction access mode.
2043 
2044  Note that there is a special syntax - SET TRANSACTION READ ONLY
2045  (or READ WRITE) that sets the access mode for the next transaction
2046  only.
2047 */
2048 
2050  public:
2051  Sys_var_transaction_read_only(const char *name_arg, const char *comment,
2052  int flag_args, ptrdiff_t off, size_t size,
2053  CMD_LINE getopt, bool def_val, PolyLock *lock,
2054  enum binlog_status_enum binlog_status_arg,
2055  on_check_function on_check_func)
2056  : Sys_var_bool(name_arg, comment, flag_args, off, size, getopt, def_val,
2057  lock, binlog_status_arg, on_check_func) {}
2058  virtual bool session_update(THD *thd, set_var *var);
2059 };
2060 
2061 /**
2062  A class for @@global.binlog_checksum that has
2063  a specialized update method.
2064 */
2066  public:
2067  Sys_var_enum_binlog_checksum(const char *name_arg, const char *comment,
2068  int flag_args, ptrdiff_t off, size_t size,
2069  CMD_LINE getopt, const char *values[],
2070  uint def_val, PolyLock *lock,
2071  enum binlog_status_enum binlog_status_arg,
2072  on_check_function on_check_func = 0)
2073  : Sys_var_enum(name_arg, comment, flag_args | PERSIST_AS_READ_ONLY, off,
2074  size, getopt, values, def_val, lock, binlog_status_arg,
2075  on_check_func, NULL) {}
2076  virtual bool global_update(THD *thd, set_var *var);
2077 };
2078 
2079 /**
2080  Class for gtid_next.
2081 */
2082 class Sys_var_gtid_next : public sys_var {
2083  public:
2085  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
2086  size_t size MY_ATTRIBUTE((unused)), CMD_LINE getopt, const char *def_val,
2087  PolyLock *lock = 0,
2088  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
2089  on_check_function on_check_func = 0,
2090  on_update_function on_update_func = 0, const char *substitute = 0,
2091  int parse_flag = PARSE_NORMAL)
2092  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
2093  getopt.arg_type, SHOW_CHAR, (intptr)def_val, lock,
2094  binlog_status_arg, on_check_func, on_update_func, substitute,
2095  parse_flag) {
2096  DBUG_ASSERT(size == sizeof(Gtid_specification));
2097  }
2098  bool session_update(THD *thd, set_var *var);
2099 
2101  DBUG_ASSERT(false);
2102  return true;
2103  }
2105  DBUG_ENTER("Sys_var_gtid_next::session_save_default");
2106  char *ptr = (char *)(intptr)option.def_value;
2107  var->save_result.string_value.str = ptr;
2108  var->save_result.string_value.length = ptr ? strlen(ptr) : 0;
2110  }
2112  void saved_value_to_string(THD *, set_var *, char *) { DBUG_ASSERT(false); }
2113  bool do_check(THD *, set_var *) { return false; }
2115  uchar *session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *) {
2116  DBUG_ENTER("Sys_var_gtid_next::session_value_ptr");
2119  ((Gtid_specification *)session_var_ptr(target_thd))
2120  ->to_string(global_sid_map, buf);
2122  char *ret = running_thd->mem_strdup(buf);
2123  DBUG_RETURN((uchar *)ret);
2124  }
2126  DBUG_ASSERT(false);
2127  return NULL;
2128  }
2129 };
2130 
2131 #ifdef HAVE_GTID_NEXT_LIST
2132 /**
2133  Class for variables that store values of type Gtid_set.
2134 
2135  The back-end storage should be a Gtid_set_or_null, and it should be
2136  set to null by default. When the variable is set for the first
2137  time, the Gtid_set* will be allocated.
2138 */
2139 class Sys_var_gtid_set : public sys_var {
2140  public:
2141  Sys_var_gtid_set(
2142  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
2143  size_t size, CMD_LINE getopt, const char *def_val, PolyLock *lock = 0,
2144  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
2145  on_check_function on_check_func = 0,
2146  on_update_function on_update_func = 0, const char *substitute = 0,
2147  int parse_flag = PARSE_NORMAL)
2148  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
2149  getopt.arg_type, SHOW_CHAR, (intptr)def_val, lock,
2150  binlog_status_arg, on_check_func, on_update_func, substitute,
2151  parse_flag) {
2152  DBUG_ASSERT(size == sizeof(Gtid_set_or_null));
2153  }
2154  bool session_update(THD *thd, set_var *var);
2155 
2156  bool global_update(THD *thd, set_var *var) {
2157  DBUG_ASSERT(false);
2158  return true;
2159  }
2160  void session_save_default(THD *thd, set_var *var) {
2161  DBUG_ENTER("Sys_var_gtid_set::session_save_default");
2163  char *ptr = (char *)(intptr)option.def_value;
2164  var->save_result.string_value.str = ptr;
2165  var->save_result.string_value.length = ptr ? strlen(ptr) : 0;
2168  }
2169  void global_save_default(THD *thd, set_var *var) { DBUG_ASSERT(false); }
2170  void saved_value_to_string(THD *, set_var *, char *) { DBUG_ASSERT(false); }
2171  bool do_check(THD *thd, set_var *var) {
2172  DBUG_ENTER("Sys_var_gtid_set::do_check");
2173  String str;
2174  String *res = var->value->val_str(&str);
2175  if (res == NULL) {
2177  DBUG_RETURN(false);
2178  }
2179  DBUG_ASSERT(res->ptr() != NULL);
2180  var->save_result.string_value.str = thd->strmake(res->ptr(), res->length());
2181  if (var->save_result.string_value.str == NULL) {
2182  my_error(ER_OUT_OF_RESOURCES, MYF(0)); // thd->strmake failed
2183  DBUG_RETURN(1);
2184  }
2185  var->save_result.string_value.length = res->length();
2186  bool ret = !Gtid_set::is_valid(res->ptr());
2187  DBUG_RETURN(ret);
2188  }
2189  bool check_update_type(Item_result type) { return type != STRING_RESULT; }
2190  uchar *session_value_ptr(THD *running_thd, THD *target_thd,
2191  LEX_STRING *base) {
2192  DBUG_ENTER("Sys_var_gtid_set::session_value_ptr");
2193  Gtid_set_or_null *gsn = (Gtid_set_or_null *)session_var_ptr(target_thd);
2194  Gtid_set *gs = gsn->get_gtid_set();
2195  if (gs == NULL) DBUG_RETURN(NULL);
2196  char *buf;
2198  buf = (char *)running_thd->alloc(gs->get_string_length() + 1);
2199  if (buf)
2200  gs->to_string(buf);
2201  else
2202  my_error(ER_OUT_OF_RESOURCES, MYF(0)); // thd->alloc failed
2204  DBUG_RETURN((uchar *)buf);
2205  }
2206  uchar *global_value_ptr(THD *thd, LEX_STRING *base) {
2207  DBUG_ASSERT(false);
2208  return NULL;
2209  }
2210 };
2211 #endif
2212 
2213 /**
2214  Abstract base class for read-only variables (global or session) of
2215  string type where the value is generated by some function. This
2216  needs to be subclassed; the session_value_ptr or global_value_ptr
2217  function should be overridden. Since these variables cannot be
2218  set at command line, they cannot be persisted.
2219 */
2221  public:
2222  Sys_var_charptr_func(const char *name_arg, const char *comment,
2223  flag_enum flag_arg)
2224  : sys_var(&all_sys_vars, name_arg, comment,
2225  READ_ONLY NON_PERSIST flag_arg, 0 /*off*/, NO_CMD_LINE.id,
2226  NO_CMD_LINE.arg_type, SHOW_CHAR, (intptr)0 /*def_val*/,
2227  NULL /*polylock*/, VARIABLE_NOT_IN_BINLOG,
2228  NULL /*on_check_func*/, NULL /*on_update_func*/,
2229  NULL /*substitute*/, PARSE_NORMAL /*parse_flag*/) {
2230  DBUG_ASSERT(flag_arg == sys_var::GLOBAL || flag_arg == sys_var::SESSION ||
2231  flag_arg == sys_var::ONLY_SESSION);
2232  }
2234  DBUG_ASSERT(false);
2235  return true;
2236  }
2238  DBUG_ASSERT(false);
2239  return true;
2240  }
2243  void saved_value_to_string(THD *, set_var *, char *) { DBUG_ASSERT(false); }
2244  bool do_check(THD *, set_var *) {
2245  DBUG_ASSERT(false);
2246  return true;
2247  }
2249  DBUG_ASSERT(false);
2250  return true;
2251  }
2253  DBUG_ASSERT(false);
2254  return NULL;
2255  }
2257  DBUG_ASSERT(false);
2258  return NULL;
2259  }
2260 };
2261 
2262 /**
2263  Class for @@global.gtid_executed.
2264 */
2266  public:
2267  Sys_var_gtid_executed(const char *name_arg, const char *comment_arg)
2268  : Sys_var_charptr_func(name_arg, comment_arg, GLOBAL) {}
2269 
2271  DBUG_ENTER("Sys_var_gtid_executed::global_value_ptr");
2273  const Gtid_set *gs = gtid_state->get_executed_gtids();
2274  char *buf = (char *)thd->alloc(gs->get_string_length() + 1);
2275  if (buf == NULL)
2276  my_error(ER_OUT_OF_RESOURCES, MYF(0));
2277  else
2278  gs->to_string(buf);
2280  DBUG_RETURN((uchar *)buf);
2281  }
2282 };
2283 
2284 /**
2285  Class for @@session.gtid_purged.
2286 */
2288  public:
2290  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
2291  size_t, CMD_LINE getopt, const char *def_val, PolyLock *lock = 0,
2292  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
2293  on_check_function on_check_func = 0,
2294  on_update_function on_update_func = 0, const char *substitute = 0,
2295  int parse_flag = PARSE_NORMAL)
2296  : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
2297  getopt.arg_type, SHOW_CHAR, (intptr)def_val, lock,
2298  binlog_status_arg, on_check_func, on_update_func, substitute,
2299  parse_flag) {}
2300 
2302  DBUG_ASSERT(false);
2303  return true;
2304  }
2305 
2307 
2308  bool global_update(THD *thd, set_var *var);
2309 
2311  /* gtid_purged does not have default value */
2312  my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str);
2313  }
2314  void saved_value_to_string(THD *, set_var *var, char *) {
2315  my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str);
2316  }
2317 
2318  bool do_check(THD *thd, set_var *var) {
2319  DBUG_ENTER("Sys_var_gtid_purged::do_check");
2320  char buf[1024];
2321  String str(buf, sizeof(buf), system_charset_info);
2322  String *res = var->value->val_str(&str);
2323  if (!res) DBUG_RETURN(true);
2325  thd->strmake(res->c_ptr(), res->length());
2326  if (!var->save_result.string_value.str) {
2327  my_error(ER_OUT_OF_RESOURCES, MYF(0)); // thd->strmake failed
2328  DBUG_RETURN(true);
2329  }
2330  var->save_result.string_value.length = res->length();
2331  bool ret =
2333  DBUG_PRINT("info", ("ret=%d", ret));
2334  DBUG_RETURN(ret);
2335  }
2336 
2338 
2340  DBUG_ENTER("Sys_var_gtid_purged::global_value_ptr");
2341  const Gtid_set *gs;
2343  if (opt_bin_log)
2344  gs = gtid_state->get_lost_gtids();
2345  else
2346  /*
2347  When binlog is off, report @@GLOBAL.GTID_PURGED from
2348  executed_gtids, since @@GLOBAL.GTID_PURGED and
2349  @@GLOBAL.GTID_EXECUTED are always same, so we did not
2350  save gtid into lost_gtids for every transaction for
2351  improving performance.
2352  */
2354  char *buf = (char *)thd->alloc(gs->get_string_length() + 1);
2355  if (buf == NULL)
2356  my_error(ER_OUT_OF_RESOURCES, MYF(0));
2357  else
2358  gs->to_string(buf);
2360  DBUG_RETURN((uchar *)buf);
2361  }
2362 
2364  DBUG_ASSERT(0);
2365  return NULL;
2366  }
2367 };
2368 
2370  public:
2371  Sys_var_gtid_owned(const char *name_arg, const char *comment_arg)
2372  : Sys_var_charptr_func(name_arg, comment_arg, SESSION) {}
2373 
2374  public:
2375  uchar *session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *) {
2376  DBUG_ENTER("Sys_var_gtid_owned::session_value_ptr");
2377  char *buf = NULL;
2378  bool remote = (target_thd != running_thd);
2379 
2380  if (target_thd->owned_gtid.sidno == 0)
2381  DBUG_RETURN((uchar *)running_thd->mem_strdup(""));
2382  else if (target_thd->owned_gtid.sidno == THD::OWNED_SIDNO_ANONYMOUS) {
2384  DBUG_RETURN((uchar *)running_thd->mem_strdup("ANONYMOUS"));
2385  } else if (target_thd->owned_gtid.sidno == THD::OWNED_SIDNO_GTID_SET) {
2386 #ifdef HAVE_GTID_NEXT_LIST
2387  buf = (char *)running_thd->alloc(
2388  target_thd->owned_gtid_set.get_string_length() + 1);
2389  if (buf) {
2391  target_thd->owned_gtid_set.to_string(buf);
2393  } else
2394  my_error(ER_OUT_OF_RESOURCES, MYF(0));
2395 #else
2396  DBUG_ASSERT(0);
2397 #endif
2398  } else {
2399  buf = (char *)running_thd->alloc(Gtid::MAX_TEXT_LENGTH + 1);
2400  if (buf) {
2401  /* Take the lock if accessing another session. */
2402  if (remote) global_sid_lock->rdlock();
2403  running_thd->owned_gtid.to_string(target_thd->owned_sid, buf);
2404  if (remote) global_sid_lock->unlock();
2405  } else
2406  my_error(ER_OUT_OF_RESOURCES, MYF(0));
2407  }
2408  DBUG_RETURN((uchar *)buf);
2409  }
2410 
2412  DBUG_ENTER("Sys_var_gtid_owned::global_value_ptr");
2413  const Owned_gtids *owned_gtids = gtid_state->get_owned_gtids();
2415  char *buf = (char *)thd->alloc(owned_gtids->get_max_string_length());
2416  if (buf)
2417  owned_gtids->to_string(buf);
2418  else
2419  my_error(ER_OUT_OF_RESOURCES, MYF(0)); // thd->alloc failed
2421  DBUG_RETURN((uchar *)buf);
2422  }
2423 };
2424 
2426  public:
2428  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
2429  size_t size, CMD_LINE getopt, const char *values[], uint def_val,
2430  PolyLock *lock = 0,
2431  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
2432  on_check_function on_check_func = 0)
2433  : Sys_var_enum(name_arg, comment, flag_args, off, size, getopt, values,
2434  def_val, lock, binlog_status_arg, on_check_func) {}
2435 
2436  bool global_update(THD *thd, set_var *var);
2437 };
2438 
2440  public:
2442  const char *name_arg, const char *comment, int flag_args, ptrdiff_t off,
2443  size_t size, CMD_LINE getopt, const ALIAS aliases[],
2445  PolyLock *lock = 0,
2446  enum binlog_status_enum binlog_status_arg = VARIABLE_NOT_IN_BINLOG,
2447  on_check_function on_check_func = 0)
2448  : Sys_var_multi_enum(name_arg, comment, flag_args, off, size, getopt,
2450  lock, binlog_status_arg, on_check_func) {}
2451 
2452  bool global_update(THD *thd, set_var *var);
2453 };
2454 
2456  public:
2457  Sys_var_binlog_encryption(const char *name_arg, const char *comment,
2458  int flag_args, ptrdiff_t off, size_t size,
2459  CMD_LINE getopt, bool def_val, PolyLock *lock,
2460  enum binlog_status_enum binlog_status_arg,
2461  on_check_function on_check_func)
2462  : Sys_var_bool(name_arg, comment, flag_args | PERSIST_AS_READ_ONLY, off,
2463  size, getopt, def_val, lock, binlog_status_arg,
2464  on_check_func) {}
2465  virtual bool global_update(THD *thd, set_var *var) override;
2466 };
2467 
2468 #endif /* SYS_VARS_H_INCLUDED */
size_t to_string(char *buf, bool need_lock=false, const String_format *string_format=NULL) const
Formats this Gtid_set as a string and saves in a given buffer.
Definition: rpl_gtid_set.cc:775
void session_save_default(THD *, set_var *)
save the session default value of the variable in var
Definition: sys_vars.h:1825
Definition: set_var.h:108
LEX_CSTRING name
Definition: set_var.h:104
double double_value
Definition: sql_class.h:2376
void do_update(plugin_ref *valptr, plugin_ref newval)
Definition: sys_vars.h:1494
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:925
The class for floating point variables.
Definition: sys_vars.h:1121
Definition: set_var.h:107
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:2427
unsigned long long int ulonglong
Definition: my_inttypes.h:69
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:550
#define DBUG_RETURN(a1)
Definition: my_dbug.h:84
not valid for UDFs
Definition: udf_registration_types.h:44
Definition: system_variables.h:174
uchar * session_value_ptr(THD *, THD *, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:1828
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:1349
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:2233
enum SHOW_COMP_OPTION(* func_)(THD *)
Definition: sys_vars.h:1869
unsigned char uchar
Definition: my_inttypes.h:49
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:819
uchar * global_value_ptr(THD *thd, LEX_STRING *base)
Definition: sys_vars.h:1099
char * str
Definition: mysql_lex_string.h:35
Definition: sql_error.h:220
Our own string classes, used pervasively throughout the executor.
LEX_STRING default_key_cache_base
Definition: keycaches.cc:63
uchar * session_value_ptr(THD *running_thd, THD *, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:1010
uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:1332
void rdlock()
Acquire the read lock.
Definition: rpl_gtid.h:453
"public" interface to sys_var - server configuration variables.
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:2300
not valid for UDFs
Definition: udf_registration_types.h:40
bool check_update_type(Item_result)
Definition: sys_vars.h:1835
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:2084
virtual uchar * global_value_ptr(THD *thd, LEX_STRING *base)
Definition: set_var.cc:334
int plugin_type
Definition: sys_vars.h:1445
A class for @global.binlog_checksum that has a specialized update method.
Definition: sys_vars.h:2065
bool session_update(THD *, set_var *)
Definition: sys_vars.h:880
size_t get_string_length(const String_format *string_format=NULL) const
Returns the length of the output from to_string.
Definition: rpl_gtid_set.cc:884
uint command_line_no_value
Definition: sys_vars.h:737
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:1157
Definition: mysql_lex_string.h:34
#define GET_STR_ALLOC
Definition: my_getopt.h:50
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:2310
uchar * session_value_ptr(THD *, THD *, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:708
void global_save_default(THD *, set_var *)
save the global default value of the variable in var
Definition: sys_vars.h:2111
Definition: sys_vars.h:842
Definition: set_var.h:110
uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:1425
bool reverse_semantics
Definition: sys_vars.h:1625
MYSQL_PLUGIN_IMPORT CHARSET_INFO * system_charset_info
Definition: mysqld.cc:1274
bool(* session_special_update_function)(THD *thd, set_var *var)
Definition: sys_vars.h:1697
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:460
uchar * session_value_ptr(THD *, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:1936
The class for bit variables - a variant of boolean that stores the value in a bit.
Definition: sys_vars.h:1623
#define base_name(A)
Definition: my_sys.h:704
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:2029
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1986
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:1534
Definition: keycache.h:70
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:1728
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
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:813
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:1513
Definition: set_var.h:114
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1501
bool unsigned_flag
Definition: item.h:2701
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:1191
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:1366
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:2237
#define GET_STR
Definition: my_getopt.h:49
Definition: set_var.h:134
The class for variables which value is a plugin.
Definition: sys_vars.h:1444
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:577
const ALIAS * aliases
Array of all textual aliases.
Definition: sys_vars.h:728
#define keycache_var(KC, OFF)
Definition: sys_vars.h:1027
union THD::@72 sys_var_tmp
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:128
bool check_update_type(Item_result type)
Definition: sys_vars.h:2337
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:1328
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:2104
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:1123
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:736
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
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:1668
bool check_update_type(Item_result type)
Definition: sys_vars.h:361
~Sys_var_version()
Definition: sys_vars.h:850
struct System_variables variables
Definition: sql_class.h:955
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:496
virtual uchar * session_value_ptr(THD *running_thd, THD *target_thd, LEX_STRING *base)
A pointer to a value of the variable for SHOW.
Definition: set_var.cc:330
bool check_update_type(Item_result)
Definition: sys_vars.h:2248
#define GET_FLAGSET
Definition: my_getopt.h:55
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:3798
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:1925
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:2994
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:1421
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:2067
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:1994
bool global_update(THD *thd, set_var *var)
Definition: sys_vars.h:1065
void session_save_default(THD *, set_var *)
save the session default value of the variable in var
Definition: sys_vars.h:888
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:704
bool check_update_type(Item_result type)
Definition: sys_vars.h:1161
int find_set(REP_SETS *sets, REP_SET *find)
Definition: mysqltest.cc:11243
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:1749
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:3822
Class for gtid_next.
Definition: sys_vars.h:2082
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:2244
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:802
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:1725
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:447
LEX_CSTRING proxy_user() const
Getter method for member m_proxy_user.
Definition: sql_security_ctx.cc:1019
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:1889
DBUG_VOID_RETURN
Definition: dbug_analyze.cc:151
char * c_ptr()
Definition: sql_string.h:241
bool is_readonly() const
Definition: set_var.h:240
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:129
The class for test_flags (core_file for now).
Definition: sys_vars.h:1185
The class for SET variables - variables taking zero or more values from the given list...
Definition: sys_vars.h:1347
bool check_update_type(Item_result type)
Definition: sys_vars.h:1020
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1153
The class for keycache_* variables.
Definition: sys_vars.h:1042
KEY_CACHE * dflt_key_cache
Definition: mf_keycache.cc:207
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1765
void saved_value_to_string(THD *, set_var *, char *)
This function converts value stored in save_result to string.
Definition: sys_vars.h:890
Definition: sys_vars.h:865
uchar * session_var_ptr(THD *thd)
A pointer to a storage area of the variable, to the raw data.
Definition: set_var.cc:338
enum_var_type type
Definition: set_var.h:376
This class represents abstract time zone and provides basic interface for MYSQL_TIME <-> my_time_t co...
Definition: tztime.h:51
virtual uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:2256
void saved_value_to_string(THD *, set_var *, char *)
This function converts value stored in save_result to string.
Definition: sys_vars.h:1772
bool check_update_type(Item_result type)
Definition: sys_vars.h:839
#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:4467
Definition: set_var.h:78
virtual void session_save_default(THD *thd, set_var *var)=0
save the session default value of the variable in var
void global_save_default(THD *, set_var *)
save the global default value of the variable in var
Definition: sys_vars.h:889
arg_type
Definition: mysqltest.cc:1432
ulonglong ulonglong_value
for all integer, set, enum sysvars
Definition: set_var.h:379
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:384
Sys_var_gtid_executed(const char *name_arg, const char *comment_arg)
Definition: sys_vars.h:2267
bool check_update_type(Item_result type)
Definition: sys_vars.h:2018
T * max_var_ptr()
Definition: sys_vars.h:296
Definition: set_var.h:106
uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:1197
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:1318
#define DBUG_EXECUTE_IF(keyword, a1)
Definition: my_dbug.h:100
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:3318
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:1167
The class for boolean variables - a variant of ENUM variables with the fixed list of values of { OFF ...
Definition: sys_vars.h:429
bool session_update(THD *, set_var *)
Definition: sys_vars.h:659
char * mem_strdup(const char *str)
Definition: sql_class.h:314
uint alias_count
The number of elements of aliases (computed in the constructor).
Definition: sys_vars.h:730
#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:1043
bool session_update(THD *, set_var *)
Definition: sys_vars.h:2301
This struct represents a specification of a GTID for a statement to be executed: either "AUTOMATIC"...
Definition: rpl_gtid.h:3587
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:2115
uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:2411
set_var_base descendant for assignments to the system variables.
Definition: set_var.h:372
#define longlong10_to_str(A, B, C)
Definition: m_string.h:291
strcpy(retval, s)
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:4536
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:1046
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:2457
const char * alias
Definition: sys_vars.h:495
struct System_variables max_system_variables
Definition: mysqld.cc:1269
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:988
Definition: sys_vars.h:2439
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:598
bool do_check(THD *thd, set_var *var)
Definition: sys_vars.h:1271
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:511
bool(* on_update_function)(sys_var *self, THD *thd, enum_var_type type)
Definition: set_var.h:140
There can be some variables which needs to be set before plugin is loaded.
Definition: set_var.h:125
Time_zone * time_zone
for Sys_var_tz
Definition: set_var.h:382
#define DBUG_PRINT(keyword, arglist)
Definition: my_dbug.h:110
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:1324
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:2000
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:1929
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:1990
virtual uchar * session_value_ptr(THD *, THD *, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:2252
This file includes constants used by all storage engines.
double(* session_special_read_double_function)(THD *thd)
Definition: sys_vars.h:1743
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:143
The class for string variables.
Definition: sys_vars.h:752
char * strmake(const char *str, size_t size) const
Definition: sql_class.h:315
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:2049
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:452
#define DBUG_ASSERT(A)
Definition: my_dbug.h:128
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
virtual uchar * session_value_ptr(THD *, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:894
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:1026
bool global_update(THD *thd, set_var *var)
Definition: sys_vars.cc:5879
#define GLOBAL_VAR(X)
Definition: sys_vars.h:104
bool opt_bin_log
Definition: mysqld.cc:951
Sys_var_proxy_user(const char *name_arg, const char *comment, enum charset_enum is_os_charset_arg)
Definition: sys_vars.h:867
A class representing one system variable - that is something that can be accessed as @global...
Definition: set_var.h:101
structure to define some default "config_option" option settings
Definition: innodb_config.h:180
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:544
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:754
uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:1674
#define DBUG_ENTER(a)
Definition: my_dbug.h:80
static const char * bool_values[3]
Definition: sys_vars.h:153
bool global_update(THD *, set_var *)
Definition: sys_vars.h:671
LEX_STRING string_value
for Sys_var_charptr and others
Definition: set_var.h:383
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:1826
USER_RESOURCES user_resources
Definition: sql_connect.h:94
bool do_check(THD *, set_var *)
Definition: sys_vars.h:2113
bool global_update(THD *thd, set_var *var)
Definition: sys_vars.cc:4007
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:1081
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:1164
LEX_CSTRING external_user() const
Getter method for member m_external_user.
Definition: sql_security_ctx.h:422
bool check_update_type(Item_result type)
Definition: sys_vars.h:1933
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1651
Definition: set_var.h:111
flag_enum
Definition: set_var.h:105
bool check_update_type(Item_result)
Definition: sys_vars.h:891
int32 get_anonymous_ownership_count()
Return the number of clients that hold anonymous ownership.
Definition: rpl_gtid.h:2679
enum enum_mysql_show_type SHOW_TYPE
Definition: set_var.h:67
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:1028
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:996
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:835
ptrdiff_t offset
offset to the value from global_system_variables
Definition: set_var.h:148
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:1465
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:1662
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:1002
virtual bool global_update(THD *thd, set_var *var)
Definition: sys_vars.cc:3647
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:1225
The class for read-only variables that show whether a particular feature is supported by the server...
Definition: sys_vars.h:1793
double
Definition: udf_registration_types.h:42
Class for @session.gtid_purged.
Definition: sys_vars.h:2287
void session_save_default(THD *, set_var *)
save the session default value of the variable in var
Definition: sys_vars.h:2306
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:463
Header for compiler-dependent features.
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:397
Definition: sys_vars.h:151
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:238
Sys_var_integer< ulong, GET_ULONG, SHOW_LONG, false > Sys_var_ulong
Definition: sys_vars.h:305
plugin_ref ha_resolve_by_name(THD *thd, const LEX_STRING *name, bool is_temp_table)
Return the storage engine handlerton for the supplied name.
Definition: handler.cc:416
The class for variables that store time zones.
Definition: sys_vars.h:1956
The class for flagset variables - a variant of SET that allows in-place editing (turning on/off indiv...
Definition: sys_vars.h:1251
#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:1184
virtual bool global_update(THD *thd, set_var *var)=0
unsigned int uint
Definition: uca-dump.cc:29
uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:1777
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:402
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.cc:3681
uchar * session_value_ptr(THD *, THD *, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:2363
void session_save_default(THD *thd, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:456
long long int longlong
Definition: my_inttypes.h:70
"protected" interface to sys_var - server configuration variables.
const uint value_count
The number of allowed numeric values.
Definition: sys_vars.h:726
#define MYF(v)
Definition: my_inttypes.h:131
KEY_CACHE * get_key_cache(const LEX_STRING *cache_name)
Definition: keycaches.cc:68
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:2051
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:3316
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:910
uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:1015
Definition: status_var.h:49
Definition: sys_vars.h:494
Sys_var_external_user(const char *name_arg, const char *comment_arg, enum charset_enum is_os_charset_arg)
Definition: sys_vars.h:902
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:1770
bool do_check(THD *thd, set_var *var)
Definition: sys_vars.h:778
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:1624
Sid_map * global_sid_map
Definition: mysqld.cc:1494
bool do_check(THD *, set_var *)
Definition: sys_vars.h:876
void saved_value_to_string(THD *, set_var *, char *)
This function converts value stored in save_result to string.
Definition: sys_vars.h:2112
bool in_init
Definition: keycache.h:128
uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:1541
Security_context * security_context() const
Definition: sql_class.h:1078
#define NON_PERSIST
Definition: sys_vars.h:130
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:1817
#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:656
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:1720
on_update_function on_update
Definition: set_var.h:150
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:1215
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:1745
Item * value
the expression that provides the new value of the variable
Definition: set_var.h:375
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:577
Definition: sys_vars.h:2425
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:6464
#define MAX_SET(X)
Definition: sys_vars.h:1235
A variant of enum where:
Definition: sys_vars.h:492
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:1213
void saved_value_to_string(THD *, set_var *, char *)
This function converts value stored in save_result to string.
Definition: sys_vars.h:1727
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:2314
void session_save_default(THD *, set_var *)
save the session default value of the variable in var
Definition: sys_vars.h:2241
Definition: sql_error.h:58
#define my_strcasecmp(s, a, b)
Definition: m_ctype.h:683
int id
Definition: sys_vars.h:163
union set_var::@66 save_result
session_special_update_function update_func
Definition: sys_vars.h:1746
#define DBUG_EXPLAIN_INITIAL(buf, len)
Definition: my_dbug.h:130
uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:1864
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:376
Abstract base class for read-only variables (global or session) of string type where the value is gen...
Definition: sys_vars.h:2220
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:1655
void saved_value_to_string(THD *, set_var *, char *)
This function converts value stored in save_result to string.
Definition: sys_vars.h:1827
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:1321
#define GET_SET
Definition: my_getopt.h:53
virtual uchar * session_value_ptr(THD *, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:907
Definition: sys_vars.h:2455
double getopt_ulonglong2double(ulonglong)
Returns the double value which corresponds to the given raw representation.
Definition: my_getopt.cc:164
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:1253
bool(* session_special_update_function)(THD *thd, set_var *var)
Definition: sys_vars.h:1742
const Owned_gtids * get_owned_gtids() const
Return a pointer to the Owned_gtids that contains the owned gtids.
Definition: rpl_gtid.h:3015
The class for variables that have a special meaning for a session, such as @timestamp or @rnd_seed1...
Definition: sys_vars.h:1696
Definition: sql_connect.h:69
static const int MAX_TEXT_LENGTH
Definition: rpl_gtid.h:3638
bool global_update(THD *, set_var *)
Definition: sys_vars.h:1821
Class for @global.gtid_executed.
Definition: sys_vars.h:2265
uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:719
virtual bool check_update_type(Item_result type)=0
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:1535
bool global_update(THD *, set_var *)
Definition: sys_vars.h:2100
Definition: sys_vars.h:2369
static const int OWNED_SIDNO_GTID_SET
Definition: sql_class.h:3317
void session_save_default(THD *, set_var *)
save the session default value of the variable in var
Definition: sys_vars.h:684
#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:927
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:152
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:2243
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
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:2441
static enum SHOW_COMP_OPTION dummy_
Definition: sys_vars.h:1870
bool do_check(THD *, set_var *)
Definition: sys_vars.h:1913
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:1958
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:1414
const char * fixup_enforce_gtid_consistency_command_line(char *value_arg)
Definition: sys_vars.cc:5727
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:1997
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:1922
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:1006
#define GET_ENUM
Definition: my_getopt.h:52
Time_zone * my_tz_find(THD *thd, const String *name)
Definition: tztime.cc:2098
bool do_check(THD *thd, set_var *var)
Definition: sys_vars.h:977
@session.dbug and @global.dbug variables.
Definition: sys_vars.h:962
uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:2125
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:1700
void global_save_default(THD *, set_var *)
save the global default value of the variable in var
Definition: sys_vars.h:1726
rpl_sidno sidno
SIDNO of this Gtid.
Definition: rpl_gtid.h:926
intptr_t intptr
Definition: my_inttypes.h:80
virtual uchar * global_value_ptr(THD *thd, LEX_STRING *base)
Definition: sys_vars.h:852
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:1634
virtual bool session_update(THD *thd, set_var *var)=0
bool global_update(THD *, set_var *)
Definition: sys_vars.h:884
void session_save_default(THD *thd, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:1509
sys_var * var
system variable to be updated
Definition: set_var.h:374
Represents the set of GTIDs that are owned by some thread.
Definition: rpl_gtid.h:2232
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:2327
const USER_CONN * get_user_connect() const
Definition: sql_class.h:1993
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1403
uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:1940
plugin_ref plugin
for Sys_var_plugin
Definition: set_var.h:381
static const char * get_name(void)
Definition: stdin_check.c:28
uchar * session_value_ptr(THD *, THD *target_thd, LEX_STRING *)
A pointer to a value of the variable for SHOW.
Definition: sys_vars.h:2003
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:299
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1914
uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:2270
bool do_check(THD *thd, set_var *var)
Definition: sys_vars.h:2318
uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:2015
Definition: sys_vars.h:900
ulonglong(* session_special_read_function)(THD *thd)
Definition: sys_vars.h:1698
Checkable_rwlock * global_sid_lock
Protects Gtid_state. See comment above gtid_state for details.
Definition: mysqld.cc:1493
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:1854
bool do_check(THD *thd, set_var *var)
Definition: sys_vars.h:1145
uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:1732
#define GET_BOOL
Definition: my_getopt.h:42
const string value("\alue\)
uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:418
Similar to Sys_var_session_special, but with double storage.
Definition: sys_vars.h:1741
session_special_update_function update_func
Definition: sys_vars.h:1701
Gtid_set * get_gtid_set() const
Return NULL if this is NULL, otherwise return the Gtid_set.
Definition: rpl_gtid.h:2191
if(++stacktop > STACKSIZ)
Definition: dbug_analyze.cc:141
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:1530
bool check_update_type(Item_result type)
Definition: sys_vars.h:2114
#define DBUG_SET(a1)
Definition: my_dbug.h:120
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:964
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:1665
const char * ptr() const
Definition: sql_string.h:240
const SHOW_TYPE show_val_type
what value_ptr() returns for sql_show.cc
Definition: set_var.h:145
#define DBUG_SET_INITIAL(a1)
Definition: my_dbug.h:121
Holds information about a Gtid_set.
Definition: rpl_gtid.h:2185
A subclass of Sys_var_have to return dynamic values.
Definition: sys_vars.h:1845
#define id
Definition: lexyy.cc:961
Key cache variable structures.
#define STRING_BUFFER_USUAL_SIZE
Definition: sql_const.h:131
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:1417
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:1314
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:3631
virtual Item_result result_type() const
Definition: item.h:964
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:844
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:1505
void plugin_unlock(THD *thd, plugin_ref plugin)
Definition: sql_plugin.cc:1196
bool global_update(THD *, set_var *)
Definition: sys_vars.h:1766
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:1411
uchar * global_value_ptr(THD *thd, LEX_STRING *)
Definition: sys_vars.h:2339
Sys_var_charptr_func(const char *name_arg, const char *comment, flag_enum flag_arg)
Definition: sys_vars.h:2222
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:1721
bool do_check(THD *thd, set_var *var)
Definition: sys_vars.h:1972
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:1773
bool do_check(THD *, set_var *)
Definition: sys_vars.h:1813
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:1448
const char * show_comp_option_name[]
Definition: mysqld.cc:814
void global_save_default(THD *, set_var *)
save the global default value of the variable in var
Definition: sys_vars.h:2242
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:1795
void global_save_default(THD *, set_var *var)
save the global default value of the variable in var
Definition: sys_vars.h:697
ulonglong ulonglong_value
Definition: sql_class.h:2375
uint test_flag_mask
Definition: sys_vars.h:1188
#define DBUG_POP()
Definition: my_dbug.h:119
void cleanup()
All the cleanup procedures should be performed here.
Definition: sys_vars.h:773
rpl_sid owned_sid
For convenience, this contains the SID component of the GTID stored in owned_gtid.
Definition: sql_class.h:3324
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:46
Gtid_state * gtid_state
Global state of GTIDs.
Definition: mysqld.cc:1495
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:2375
double double_value
for Sys_var_double
Definition: set_var.h:380
#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:2289
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:943
LEX_STRING base
for structured variables, like keycache_name.variable_name
Definition: set_var.h:387
const Gtid_set * get_executed_gtids() const
Definition: rpl_gtid.h:2999
size_t length() const
Definition: sql_string.h:233
bool do_check(THD *, set_var *var)
Definition: sys_vars.h:628
bool session_update(THD *thd, set_var *var)
Definition: sys_vars.h:1310
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:133
uchar * global_value_ptr(THD *, LEX_STRING *)
Definition: sys_vars.h:1832
Class representing the &#39;transaction_isolation&#39; system variable.
Definition: sys_vars.h:2027
#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:289
bool test_flag_value
Definition: sys_vars.h:1187
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
void global_save_default(THD *, set_var *)
save the global default value of the variable in var
Definition: sys_vars.h:1771
bool global_update(THD *, set_var *var)
Definition: sys_vars.h:1918
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:1704
bool(* on_check_function)(sys_var *self, THD *thd, set_var *var)
Definition: set_var.h:139
void session_save_default(THD *, set_var *)
save the session default value of the variable in var
Definition: sys_vars.h:1001
#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:1170
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:431
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:776
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:1407
void session_save_default(THD *, set_var *var)
save the session default value of the variable in var
Definition: sys_vars.h:1659
Definition: set_var.h:89
Sys_var_gtid_owned(const char *name_arg, const char *comment_arg)
Definition: sys_vars.h:2371
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