MySQL 8.4.0
Source Code Documentation
sql_plugin_var.cc File Reference
#include "sql/sql_plugin_var.h"
#include <limits.h>
#include <string>
#include <unordered_map>
#include <utility>
#include "map_helpers.h"
#include "my_dbug.h"
#include "my_list.h"
#include "mysql/psi/mysql_mutex.h"
#include "mysql/status_var.h"
#include "mysql/strings/dtoa.h"
#include "mysql/strings/int2str.h"
#include "mysql/strings/m_ctype.h"
#include "nulls.h"
#include "sql/current_thd.h"
#include "sql/item.h"
#include "sql/mysqld.h"
#include "sql/psi_memory_key.h"
#include "sql/set_var.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_plugin.h"
#include "sql/strfunc.h"
#include "sql/sys_vars_shared.h"
#include "sql/system_variables.h"
#include "sql_string.h"
#include "strxmov.h"
#include "template_utils.h"
#include "typelib.h"

Functions

bool plugin_var_memalloc_global_update (THD *thd, SYS_VAR *var, char **dest, const char *value)
 Set value for global variable with PLUGIN_VAR_MEMALLOC flag. More...
 
bool plugin_var_memalloc_session_update (THD *thd, SYS_VAR *var, char **dest, const char *value)
 Set value for thread local variable with PLUGIN_VAR_MEMALLOC flag. More...
 
SHOW_TYPE pluginvar_show_type (SYS_VAR *plugin_var)
 
const void * pluginvar_default_value (SYS_VAR *plugin_var)
 
ucharintern_sys_var_ptr (THD *thd, int offset, bool global_lock)
 
int item_value_type (st_mysql_value *value)
 
const char * item_val_str (st_mysql_value *value, char *buffer, int *length)
 
int item_val_int (st_mysql_value *value, long long *buf)
 
int item_is_unsigned (st_mysql_value *value)
 
int item_val_real (st_mysql_value *value, double *buf)
 
int check_func_bool (THD *, SYS_VAR *, void *save, st_mysql_value *value)
 
int check_func_int (THD *thd, SYS_VAR *var, void *save, st_mysql_value *value)
 
int check_func_long (THD *thd, SYS_VAR *var, void *save, st_mysql_value *value)
 
int check_func_longlong (THD *thd, SYS_VAR *var, void *save, st_mysql_value *value)
 
int check_func_str (THD *thd, SYS_VAR *, void *save, st_mysql_value *value)
 
int check_func_enum (THD *, SYS_VAR *var, void *save, st_mysql_value *value)
 
int check_func_set (THD *, SYS_VAR *var, void *save, st_mysql_value *value)
 
int check_func_double (THD *thd, SYS_VAR *var, void *save, st_mysql_value *value)
 
void update_func_bool (THD *, SYS_VAR *, void *tgt, const void *save)
 
void update_func_int (THD *, SYS_VAR *, void *tgt, const void *save)
 
void update_func_long (THD *, SYS_VAR *, void *tgt, const void *save)
 
void update_func_longlong (THD *, SYS_VAR *, void *tgt, const void *save)
 
void update_func_str (THD *, SYS_VAR *, void *tgt, const void *save)
 
void update_func_double (THD *, SYS_VAR *, void *tgt, const void *save)
 
st_bookmarkfind_bookmark (const char *plugin, const char *name, int flags)
 
void plugin_opt_set_limits (struct my_option *options, const SYS_VAR *opt)
 

Function Documentation

◆ check_func_bool()

int check_func_bool ( THD ,
SYS_VAR ,
void *  save,
st_mysql_value value 
)

◆ check_func_double()

int check_func_double ( THD thd,
SYS_VAR var,
void *  save,
st_mysql_value value 
)

◆ check_func_enum()

int check_func_enum ( THD ,
SYS_VAR var,
void *  save,
st_mysql_value value 
)

◆ check_func_int()

int check_func_int ( THD thd,
SYS_VAR var,
void *  save,
st_mysql_value value 
)

◆ check_func_long()

int check_func_long ( THD thd,
SYS_VAR var,
void *  save,
st_mysql_value value 
)

◆ check_func_longlong()

int check_func_longlong ( THD thd,
SYS_VAR var,
void *  save,
st_mysql_value value 
)

◆ check_func_set()

int check_func_set ( THD ,
SYS_VAR var,
void *  save,
st_mysql_value value 
)

◆ check_func_str()

int check_func_str ( THD thd,
SYS_VAR ,
void *  save,
st_mysql_value value 
)

◆ find_bookmark()

st_bookmark * find_bookmark ( const char *  plugin,
const char *  name,
int  flags 
)

◆ intern_sys_var_ptr()

uchar * intern_sys_var_ptr ( THD thd,
int  offset,
bool  global_lock 
)

◆ item_is_unsigned()

int item_is_unsigned ( st_mysql_value value)

◆ item_val_int()

int item_val_int ( st_mysql_value value,
long long *  buf 
)

◆ item_val_real()

int item_val_real ( st_mysql_value value,
double *  buf 
)

◆ item_val_str()

const char * item_val_str ( st_mysql_value value,
char *  buffer,
int *  length 
)

◆ item_value_type()

int item_value_type ( st_mysql_value value)

◆ plugin_opt_set_limits()

void plugin_opt_set_limits ( struct my_option options,
const SYS_VAR opt 
)

◆ plugin_var_memalloc_global_update()

bool plugin_var_memalloc_global_update ( THD thd,
SYS_VAR var,
char **  dest,
const char *  value 
)

Set value for global variable with PLUGIN_VAR_MEMALLOC flag.

Parameters
[in]thdThread context.
[in]varPlugin variable.
[in,out]destDestination memory pointer.
[in]value'\0'-terminated new value.
Returns
Completion status
Return values
falseSuccess
trueFailure

◆ plugin_var_memalloc_session_update()

bool plugin_var_memalloc_session_update ( THD thd,
SYS_VAR var,
char **  dest,
const char *  value 
)

Set value for thread local variable with PLUGIN_VAR_MEMALLOC flag.

Parameters
[in]thdThread context.
[in]varPlugin variable.
[in,out]destDestination memory pointer.
[in]value'\0'-terminated new value.

Most plugin variable values are stored on dynamic_variables_ptr. Releasing memory occupied by these values is as simple as freeing dynamic_variables_ptr.

An exception to the rule are PLUGIN_VAR_MEMALLOC variables, which are stored on individual memory hunks. All of these hunks has to be freed when it comes to cleanup.

It may happen that a plugin was uninstalled and descriptors of it's variables are lost. In this case it is impossible to locate corresponding values.

In addition to allocating and setting variable value, new element is added to dynamic_variables_allocs list. When thread is done, it has to call plugin_var_memalloc_free() to release memory used by PLUGIN_VAR_MEMALLOC variables.

If var is NULL, variable update function is not called. This is needed when we take snapshot of system variables during thread initialization.

Note
List element and variable value are stored on the same memory hunk. List element is followed by variable value.
Returns
Completion status
Return values
falseSuccess
trueFailure

◆ pluginvar_default_value()

const void * pluginvar_default_value ( SYS_VAR plugin_var)

◆ pluginvar_show_type()

SHOW_TYPE pluginvar_show_type ( SYS_VAR plugin_var)

◆ update_func_bool()

void update_func_bool ( THD ,
SYS_VAR ,
void *  tgt,
const void *  save 
)

◆ update_func_double()

void update_func_double ( THD ,
SYS_VAR ,
void *  tgt,
const void *  save 
)

◆ update_func_int()

void update_func_int ( THD ,
SYS_VAR ,
void *  tgt,
const void *  save 
)

◆ update_func_long()

void update_func_long ( THD ,
SYS_VAR ,
void *  tgt,
const void *  save 
)

◆ update_func_longlong()

void update_func_longlong ( THD ,
SYS_VAR ,
void *  tgt,
const void *  save 
)

◆ update_func_str()

void update_func_str ( THD ,
SYS_VAR ,
void *  tgt,
const void *  save 
)