MySQL  8.0.16
Source Code Documentation
set_var.h File Reference

"public" interface to sys_var - server configuration variables. More...

#include "my_config.h"
#include <stddef.h>
#include <string.h>
#include <sys/types.h>
#include <string>
#include <vector>
#include "lex_string.h"
#include "m_ctype.h"
#include "my_getopt.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "my_systime.h"
#include "mysql/components/services/system_variable_source_type.h"
#include "mysql/status_var.h"
#include "mysql/udf_registration_types.h"
#include "mysql_com.h"
#include "prealloced_array.h"
#include "sql/sql_const.h"
#include "sql/sql_plugin_ref.h"
#include "typelib.h"

Go to the source code of this file.

Classes

class  collation_unordered_map< Key, Value >
 std::unordered_map, but with my_malloc and collation-aware comparison. More...
 
class  List< T >
 
struct  sys_var_chain
 
class  sys_var
 A class representing one system variable - that is something that can be accessed as @global.variable_name or @session.variable_name, visible in SHOW xxx VARIABLES and in INFORMATION_SCHEMA.xxx_VARIABLES, optionally it can be assigned to, optionally it can have a command-line counterpart with the same name. More...
 
class  set_var_base
 A base class for everything that can be set with SET command. More...
 
class  set_var
 set_var_base descendant for assignments to the system variables. More...
 
class  set_var_user
 
class  set_var_password
 
class  set_var_collation_client
 

Macros

#define SHOW_VAR_PREALLOC   200
 
#define PERSIST_ONLY_ADMIN_X509_SUBJECT   "persist_only_admin_x509_subject"
 
#define PERSISTED_GLOBALS_LOAD   "persisted_globals_load"
 

Typedefs

typedef ulonglong sql_mode_t
 
typedef enum enum_mysql_show_type SHOW_TYPE
 
typedef enum enum_mysql_show_scope SHOW_SCOPE
 
typedef Prealloced_array< SHOW_VAR, SHOW_VAR_PREALLOCShow_var_array
 

Enumerations

enum  enum_var_type : int {
  OPT_DEFAULT = 0, OPT_SESSION, OPT_GLOBAL, OPT_PERSIST,
  OPT_PERSIST_ONLY
}
 

Functions

int mysql_add_sys_var_chain (sys_var *chain)
 Add variables to the dynamic hash of system variables. More...
 
int mysql_del_sys_var_chain (sys_var *chain)
 
ulong get_system_variable_hash_records (void)
 
ulonglong get_system_variable_hash_version (void)
 
collation_unordered_map< std::string, sys_var * > * get_system_variable_hash (void)
 
bool get_sysvar_source (const char *name, uint length, enum enum_variable_source *source)
 Get source of a given system variable given its name and name length. More...
 
bool enumerate_sys_vars (Show_var_array *show_var_array, bool sort, enum enum_var_type type, bool strict)
 Constructs an array of system variables for display to the user. More...
 
void lock_plugin_mutex ()
 
void unlock_plugin_mutex ()
 
sys_varfind_sys_var (THD *thd, const char *str, size_t length=0)
 
sys_varfind_sys_var_ex (THD *thd, const char *str, size_t length=0, bool throw_error=false, bool locked=false)
 
int sql_set_variables (THD *thd, List< set_var_base > *var_list, bool opened)
 Execute update of all variables. More...
 
bool keyring_access_test ()
 This function is used to check if key management UDFs like keying_key_generate/store/remove should proceed or not. More...
 
bool fix_delay_key_write (sys_var *self, THD *thd, enum_var_type type)
 
sql_mode_t expand_sql_mode (sql_mode_t sql_mode, THD *thd)
 
bool sql_mode_string_representation (THD *thd, sql_mode_t sql_mode, LEX_STRING *ls)
 
bool sql_mode_quoted_string_representation (THD *thd, sql_mode_t sql_mode, LEX_STRING *ls)
 
void update_parser_max_mem_size ()
 
const CHARSET_INFOget_old_charset_by_name (const char *old_name)
 
int sys_var_init ()
 
int sys_var_add_options (std::vector< my_option > *long_options, int parse_flags)
 
void sys_var_end (void)
 
bool check_priv (THD *thd, bool static_variable)
 This function will check for necessary privileges needed to perform RESET PERSIST or SET PERSIST[_ONLY] operation. More...
 

Variables

TYPELIB bool_typelib
 
SHOW_COMP_OPTION have_profiling
 
SHOW_COMP_OPTION have_symlink
 
SHOW_COMP_OPTION have_dlopen
 
SHOW_COMP_OPTION have_query_cache
 
SHOW_COMP_OPTION have_geometry
 
SHOW_COMP_OPTION have_rtree_keys
 
SHOW_COMP_OPTION have_compress
 
SHOW_COMP_OPTION have_statement_timeout
 
sys_varSys_autocommit_ptr
 
sys_varSys_gtid_next_ptr
 
sys_varSys_gtid_next_list_ptr
 
sys_varSys_gtid_purged_ptr
 
ulonglong system_variable_hash_version
 
char * sys_var_persist_only_admin_x509_subject
 global X509 subject name to require from the client session to allow SET PERSIST[_ONLY] on sys_var::NOTPERSIST variables More...
 

Detailed Description

"public" interface to sys_var - server configuration variables.

Macro Definition Documentation

◆ PERSIST_ONLY_ADMIN_X509_SUBJECT

#define PERSIST_ONLY_ADMIN_X509_SUBJECT   "persist_only_admin_x509_subject"

◆ PERSISTED_GLOBALS_LOAD

#define PERSISTED_GLOBALS_LOAD   "persisted_globals_load"

◆ SHOW_VAR_PREALLOC

#define SHOW_VAR_PREALLOC   200

Typedef Documentation

◆ SHOW_SCOPE

◆ SHOW_TYPE

◆ Show_var_array

◆ sql_mode_t

Enumeration Type Documentation

◆ enum_var_type

enum enum_var_type : int
Enumerator
OPT_DEFAULT 
OPT_SESSION 
OPT_GLOBAL 
OPT_PERSIST 
OPT_PERSIST_ONLY 

Function Documentation

◆ check_priv()

bool check_priv ( THD thd,
bool  static_variable 
)

This function will check for necessary privileges needed to perform RESET PERSIST or SET PERSIST[_ONLY] operation.

Parameters
[in]thdPointer to connection handle.
[in]static_variabledescribes if variable is static or dynamic
Returns
0 Success
1 Failure

◆ enumerate_sys_vars()

bool enumerate_sys_vars ( Show_var_array show_var_array,
bool  sort,
enum enum_var_type  query_scope,
bool  strict 
)

Constructs an array of system variables for display to the user.

Parameters
show_var_arrayPrealloced_array of SHOW_VAR elements for display
sortIf true, the system variables should be sorted
query_scopeOPT_GLOBAL or OPT_SESSION for SHOW GLOBAL|SESSION VARIABLES
strictUse strict scope checking
Return values
Trueon error, false otherwise

◆ expand_sql_mode()

sql_mode_t expand_sql_mode ( sql_mode_t  sql_mode,
THD thd 
)

◆ find_sys_var()

sys_var* find_sys_var ( THD thd,
const char *  str,
size_t  length = 0 
)

◆ find_sys_var_ex()

sys_var* find_sys_var_ex ( THD thd,
const char *  str,
size_t  length = 0,
bool  throw_error = false,
bool  locked = false 
)

◆ fix_delay_key_write()

bool fix_delay_key_write ( sys_var ,
THD ,
enum_var_type   
)

◆ get_old_charset_by_name()

const CHARSET_INFO* get_old_charset_by_name ( const char *  old_name)

◆ get_system_variable_hash()

collation_unordered_map<std::string, sys_var *>* get_system_variable_hash ( void  )

◆ get_system_variable_hash_records()

ulong get_system_variable_hash_records ( void  )

◆ get_system_variable_hash_version()

ulonglong get_system_variable_hash_version ( void  )

◆ get_sysvar_source()

bool get_sysvar_source ( const char *  name,
uint  length,
enum enum_variable_source source 
)

Get source of a given system variable given its name and name length.

◆ keyring_access_test()

bool keyring_access_test ( )

This function is used to check if key management UDFs like keying_key_generate/store/remove should proceed or not.

If global variable @keyring_operations is OFF then above said udfs will fail.

Returns
Operation status
Return values
0OK
1ERROR, keyring operations are not allowed
See also
Sys_keyring_operations

◆ lock_plugin_mutex()

void lock_plugin_mutex ( )

◆ mysql_add_sys_var_chain()

int mysql_add_sys_var_chain ( sys_var first)

Add variables to the dynamic hash of system variables.

Parameters
firstPointer to first system variable to add
Return values
0SUCCESS
otherwiseFAILURE

◆ mysql_del_sys_var_chain()

int mysql_del_sys_var_chain ( sys_var chain)

◆ sql_mode_quoted_string_representation()

bool sql_mode_quoted_string_representation ( THD thd,
sql_mode_t  sql_mode,
LEX_STRING ls 
)

◆ sql_mode_string_representation()

bool sql_mode_string_representation ( THD thd,
sql_mode_t  sql_mode,
LEX_STRING ls 
)

◆ sql_set_variables()

int sql_set_variables ( THD thd,
List< set_var_base > *  var_list,
bool  opened 
)

Execute update of all variables.

First run a check of all variables that all updates will go ok. If yes, then execute all updates, returning an error if any one failed.

This should ensure that in all normal cases none all or variables are updated.

Parameters
thdThread id
var_listList of variables to update
openedTrue means tables are open and this function will lock them.
Return values
0ok
1ERROR, message sent (normally no variables was updated)
-1ERROR, message not sent

◆ sys_var_add_options()

int sys_var_add_options ( std::vector< my_option > *  long_options,
int  parse_flags 
)

◆ sys_var_end()

void sys_var_end ( void  )

◆ sys_var_init()

int sys_var_init ( )

◆ unlock_plugin_mutex()

void unlock_plugin_mutex ( )

◆ update_parser_max_mem_size()

void update_parser_max_mem_size ( )

Variable Documentation

◆ bool_typelib

TYPELIB bool_typelib

◆ have_compress

SHOW_COMP_OPTION have_compress

◆ have_dlopen

SHOW_COMP_OPTION have_dlopen

◆ have_geometry

SHOW_COMP_OPTION have_geometry

◆ have_profiling

SHOW_COMP_OPTION have_profiling

◆ have_query_cache

SHOW_COMP_OPTION have_query_cache

◆ have_rtree_keys

SHOW_COMP_OPTION have_rtree_keys

◆ have_statement_timeout

SHOW_COMP_OPTION have_statement_timeout

◆ have_symlink

SHOW_COMP_OPTION have_symlink

◆ Sys_autocommit_ptr

sys_var* Sys_autocommit_ptr

◆ Sys_gtid_next_list_ptr

sys_var* Sys_gtid_next_list_ptr

◆ Sys_gtid_next_ptr

sys_var* Sys_gtid_next_ptr

◆ Sys_gtid_purged_ptr

sys_var* Sys_gtid_purged_ptr

◆ sys_var_persist_only_admin_x509_subject

char* sys_var_persist_only_admin_x509_subject

global X509 subject name to require from the client session to allow SET PERSIST[_ONLY] on sys_var::NOTPERSIST variables

See also
set_var::resolve

◆ system_variable_hash_version

ulonglong system_variable_hash_version