MySQL 8.4.2
Source Code Documentation
set_var.h File Reference

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

#include "my_config.h"
#include <sys/types.h>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <functional>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include "lex_string.h"
#include "my_getopt.h"
#include "my_hostname.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/strings/m_ctype.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

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  System_variable_tracker
 Wrapper interface for all kinds of system variables. More...
 
struct  System_variable_tracker::Static
 
struct  System_variable_tracker::Keycache
 
struct  System_variable_tracker::Plugin
 
struct  System_variable_tracker::Component
 
struct  System_variable_tracker::Cache
 
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 PERSIST_ONLY_ADMIN_X509_SUBJECT   "persist_only_admin_x509_subject"
 
#define PERSISTED_GLOBALS_LOAD   "persisted_globals_load"
 

Typedefs

using sql_mode_t = uint64_t
 
typedef enum enum_mysql_show_type SHOW_TYPE
 
typedef enum enum_mysql_show_scope SHOW_SCOPE
 

Enumerations

enum  enum_var_type : int {
  OPT_DEFAULT = 0 , OPT_SESSION , OPT_GLOBAL , OPT_PERSIST ,
  OPT_PERSIST_ONLY
}
 
enum class  Suppress_not_found_error { NO , YES }
 
enum class  Force_sensitive_system_variable_access { NO , YES }
 
enum class  Is_already_locked { NO , YES }
 
enum class  Is_single_thread { NO , YES }
 

Functions

bool add_static_system_variable_chain (sys_var *chain)
 Add variables to the hash of static system variables. More...
 
bool add_dynamic_system_variable_chain (sys_var *chain)
 Add variables to the dynamic hash of system variables. More...
 
void delete_dynamic_system_variable_chain (sys_var *chain)
 Remove variables from the dynamic hash of system variables. More...
 
ulong get_system_variable_count (void)
 
ulonglong get_dynamic_system_variable_hash_version (void)
 
collation_unordered_map< std::string, sys_var * > * get_static_system_variable_hash (void)
 
collation_unordered_map< std::string, sys_var * > * get_dynamic_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...
 
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)
 
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 dynamic_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"

Typedef Documentation

◆ SHOW_SCOPE

◆ SHOW_TYPE

◆ sql_mode_t

using sql_mode_t = uint64_t

Enumeration Type Documentation

◆ enum_var_type

enum enum_var_type : int
Enumerator
OPT_DEFAULT 
OPT_SESSION 
OPT_GLOBAL 
OPT_PERSIST 
OPT_PERSIST_ONLY 

◆ Force_sensitive_system_variable_access

Enumerator
NO 
YES 

◆ Is_already_locked

enum class Is_already_locked
strong
Enumerator
NO 
YES 

◆ Is_single_thread

enum class Is_single_thread
strong
Enumerator
NO 
YES 

◆ Suppress_not_found_error

enum class Suppress_not_found_error
strong
Enumerator
NO 
YES 

Function Documentation

◆ add_dynamic_system_variable_chain()

bool add_dynamic_system_variable_chain ( sys_var first)

Add variables to the dynamic hash of system variables.

Parameters
firstPointer to first system variable to add
Returns
false on success, otherwise true.
Note
Requires r/w lock on LOCK_system_variables_hash.

◆ add_static_system_variable_chain()

bool add_static_system_variable_chain ( sys_var first)

Add variables to the hash of static system variables.

Parameters
firstPointer to first system variable to add
Returns
false on success, otherwise true.

◆ 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

◆ delete_dynamic_system_variable_chain()

void delete_dynamic_system_variable_chain ( sys_var first)

Remove variables from the dynamic hash of system variables.

Parameters
firstPointer to first system variable to remove
Note
Requires r/w lock on LOCK_system_variables_hash.

◆ expand_sql_mode()

sql_mode_t expand_sql_mode ( sql_mode_t  sql_mode,
THD thd 
)

◆ fix_delay_key_write()

bool fix_delay_key_write ( sys_var self,
THD thd,
enum_var_type  type 
)

◆ get_dynamic_system_variable_hash()

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

◆ get_dynamic_system_variable_hash_version()

ulonglong get_dynamic_system_variable_hash_version ( void  )

◆ get_old_charset_by_name()

const CHARSET_INFO * get_old_charset_by_name ( const char *  old_name)

◆ get_static_system_variable_hash()

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

◆ get_system_variable_count()

ulong get_system_variable_count ( 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.

Note
Holds an intermediate lock on LOCK_system_variables_hash.

◆ 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

◆ 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 ( )

Variable Documentation

◆ bool_typelib

TYPELIB bool_typelib
extern

◆ dynamic_system_variable_hash_version

ulonglong dynamic_system_variable_hash_version
extern

◆ have_compress

SHOW_COMP_OPTION have_compress
extern

◆ have_dlopen

SHOW_COMP_OPTION have_dlopen

◆ have_geometry

SHOW_COMP_OPTION have_geometry
extern

◆ have_profiling

SHOW_COMP_OPTION have_profiling
extern

◆ have_query_cache

SHOW_COMP_OPTION have_query_cache
extern

◆ have_rtree_keys

SHOW_COMP_OPTION have_rtree_keys

◆ have_statement_timeout

SHOW_COMP_OPTION have_statement_timeout
extern

◆ have_symlink

SHOW_COMP_OPTION have_symlink
extern

◆ Sys_autocommit_ptr

sys_var* Sys_autocommit_ptr
extern

◆ Sys_gtid_next_list_ptr

sys_var* Sys_gtid_next_list_ptr
extern

◆ Sys_gtid_next_ptr

sys_var* Sys_gtid_next_ptr
extern

◆ Sys_gtid_purged_ptr

sys_var* Sys_gtid_purged_ptr
extern

◆ sys_var_persist_only_admin_x509_subject

char* sys_var_persist_only_admin_x509_subject
extern

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