MySQL 8.4.2
Source Code Documentation
|
#include "sql/set_var.h"
#include <sys/types.h>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <string>
#include <string_view>
#include <utility>
#include "m_string.h"
#include "map_helpers.h"
#include "my_dbug.h"
#include "my_io.h"
#include "my_sys.h"
#include "mysql/components/services/bits/psi_bits.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/components/services/log_shared.h"
#include "mysql/my_loglevel.h"
#include "mysql/plugin_audit.h"
#include "mysql/psi/mysql_mutex.h"
#include "mysql/psi/mysql_rwlock.h"
#include "mysql/strings/dtoa.h"
#include "mysql/strings/int2str.h"
#include "mysql/strings/m_ctype.h"
#include "mysqld_error.h"
#include "sql/auth/auth_acls.h"
#include "sql/auth/auth_common.h"
#include "sql/auth/sql_security_ctx.h"
#include "sql/debug_sync.h"
#include "sql/derror.h"
#include "sql/enum_query_type.h"
#include "sql/item.h"
#include "sql/item_func.h"
#include "sql/log.h"
#include "sql/mysqld.h"
#include "sql/persisted_variable.h"
#include "sql/protocol_classic.h"
#include "sql/session_tracker.h"
#include "sql/sql_audit.h"
#include "sql/sql_base.h"
#include "sql/sql_class.h"
#include "sql/sql_error.h"
#include "sql/sql_lex.h"
#include "sql/sql_list.h"
#include "sql/sql_parse.h"
#include "sql/sql_plugin_ref.h"
#include "sql/sql_plugin_var.h"
#include "sql/sql_select.h"
#include "sql/sql_show.h"
#include "sql/sys_vars_shared.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/thd_raii.h"
#include "sql_string.h"
#include "string_with_len.h"
#include "strxnmov.h"
Classes | |
struct | my_old_conv |
Functions | |
collation_unordered_map< string, sys_var * > * | get_static_system_variable_hash () |
collation_unordered_map< string, sys_var * > * | get_dynamic_system_variable_hash () |
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 | sys_var_init () |
int | sys_var_add_options (std::vector< my_option > *long_options, int parse_flags) |
void | sys_var_end () |
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... | |
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. More... | |
bool | throw_bounds_warning (THD *thd, const char *name, bool fixed, double v) |
static void | set_tail_to_triple_dot (char *s, size_t size) |
template<size_t N> | |
static void | copy_name (char(&to)[N], std::string_view from) |
static void | merge_names (char *to, size_t capacity, std::string_view from1, std::string_view from2) |
const CHARSET_INFO * | get_old_charset_by_name (const char *name) |
bool | add_dynamic_system_variable_chain (sys_var *first) |
Add variables to the dynamic hash of system variables. More... | |
bool | add_static_system_variable_chain (sys_var *first) |
Add variables to the hash of static system variables. More... | |
void | delete_dynamic_system_variable_chain (sys_var *first) |
Remove variables from the dynamic hash of system variables. More... | |
ulong | get_system_variable_count (void) |
ulonglong | get_dynamic_system_variable_hash_version (void) |
sys_var * | find_static_system_variable (const std::string &name) |
Find a static system variable. More... | |
sys_var * | find_dynamic_system_variable (const std::string &name) |
Find a dynamic system variable. More... | |
sys_var * | intern_find_sys_var (const char *str, size_t length) |
Find a system variable, either static or dynamic. More... | |
sys_var * | check_find_sys_var (THD *thd, const char *str, size_t length, bool *sensitive) |
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... | |
static bool | can_persist_non_persistent_var (THD *thd, sys_var *var, enum_var_type setvar_type) |
Checks if a THD can set non-persist variables. More... | |
Variables | |
static collation_unordered_map< string, sys_var * > * | static_system_variable_hash |
static collation_unordered_map< string, sys_var * > * | dynamic_system_variable_hash |
static PolyLock_mutex PLock_global_system_variables & | LOCK_global_system_variables |
ulonglong | dynamic_system_variable_hash_version = 0 |
static collation_unordered_set< string > * | never_persistable_vars |
list of variables that shouldn't be persisted in all cases More... | |
sys_var_chain | all_sys_vars = {nullptr, nullptr} |
static my_old_conv | old_conv [] |
char * | sys_var_persist_only_admin_x509_subject = nullptr |
global X509 subject name to require from the client session to allow SET PERSIST[_ONLY] on sys_var::NOTPERSIST variables More... | |
bool add_dynamic_system_variable_chain | ( | sys_var * | first | ) |
Add variables to the dynamic hash of system variables.
first | Pointer to first system variable to add |
bool add_static_system_variable_chain | ( | sys_var * | first | ) |
Add variables to the hash of static system variables.
first | Pointer to first system variable to add |
|
static |
Checks if a THD can set non-persist variables.
Requires that: the session uses SSL the peer has presented a valid certificate the certificate has a certain subject name
The format checked is deliberately kept the same as the other SSL system and status variables representing names. Hence X509_NAME_oneline is used.
true | the THD can set NON_PERSIST variables |
false | usual restrictions apply |
thd | the THD handle |
var | the variable to be set |
setvar_type | the operation to check against. |
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.
[in] | thd | Pointer to connection handle. |
[in] | static_variable | describes if variable is static or dynamic |
|
static |
void delete_dynamic_system_variable_chain | ( | sys_var * | first | ) |
Remove variables from the dynamic hash of system variables.
first | Pointer to first system variable to remove |
sys_var * find_dynamic_system_variable | ( | const std::string & | name | ) |
Find a dynamic system variable.
name | Name of system variable to find |
pointer | pointer to variable definitions |
nullptr | 1. Unknown static variable (error message is given).
|
sys_var * find_static_system_variable | ( | const std::string & | name | ) |
Find a static system variable.
name | Name of system variable to find |
pointer | pointer to variable definitions |
nullptr | 1. Unknown static variable (error message is given).
|
collation_unordered_map< string, sys_var * > * get_dynamic_system_variable_hash | ( | void | ) |
ulonglong get_dynamic_system_variable_hash_version | ( | void | ) |
const CHARSET_INFO * get_old_charset_by_name | ( | const char * | name | ) |
collation_unordered_map< string, sys_var * > * get_static_system_variable_hash | ( | void | ) |
ulong get_system_variable_count | ( | 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.
sys_var * intern_find_sys_var | ( | const char * | str, |
size_t | length | ||
) |
Find a system variable, either static or dynamic.
str | Name of system variable to find |
length | Length of variable. zero means that we should use strlen() on the variable |
pointer | pointer to variable definitions |
nullptr | 1. Unknown variable (error message is given).
|
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.
0 | OK |
1 | ERROR, keyring operations are not allowed |
|
static |
|
static |
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.
thd | Thread id |
var_list | List of variables to update |
opened | True means tables are open and this function will lock them. |
0 | ok |
1 | ERROR, message sent (normally no variables was updated) |
-1 | ERROR, message not sent |
int sys_var_add_options | ( | std::vector< my_option > * | long_options, |
int | parse_flags | ||
) |
void sys_var_end | ( | void | ) |
int sys_var_init | ( | ) |
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.
Plug-in interface also uses this.
thd | thread handle |
name | variable's name |
fixed | did we have to correct the value? (throw warn/err if so) |
is_unsigned | is value's type unsigned? |
v | variable's value |
true | on error, false otherwise (warning or ok) |
bool throw_bounds_warning | ( | THD * | thd, |
const char * | name, | ||
bool | fixed, | ||
double | v | ||
) |
sys_var_chain all_sys_vars = {nullptr, nullptr} |
|
static |
ulonglong dynamic_system_variable_hash_version = 0 |
|
static |
|
static |
list of variables that shouldn't be persisted in all cases
|
static |
|
static |
char* sys_var_persist_only_admin_x509_subject = nullptr |
global X509 subject name to require from the client session to allow SET PERSIST[_ONLY] on sys_var::NOTPERSIST variables