MySQL  8.0.17
Source Code Documentation
sys_var_pluginvar Class Reference

#include <sql_plugin_var.h>

Inheritance diagram for sys_var_pluginvar:
sys_var

Public Member Functions

 sys_var_pluginvar (sys_var_chain *chain, const char *name_arg, SYS_VAR *plugin_var_arg)
 
sys_var_pluginvarcast_pluginvar ()
 downcast for sys_var_pluginvar. More...
 
bool check_update_type (Item_result type)
 
SHOW_TYPE show_type ()
 
ucharreal_value_ptr (THD *thd, enum_var_type type)
 
TYPELIBplugin_var_typelib (void)
 
uchardo_value_ptr (THD *running_thd, THD *target_thd, enum_var_type type, LEX_STRING *base)
 
uchardo_value_ptr (THD *thd, enum_var_type type, LEX_STRING *base)
 
const ucharsession_value_ptr (THD *running_thd, THD *target_thd, LEX_STRING *base)
 A pointer to a value of the variable for SHOW. More...
 
const ucharglobal_value_ptr (THD *thd, LEX_STRING *base)
 
bool do_check (THD *thd, set_var *var)
 
virtual void session_save_default (THD *, set_var *)
 save the session default value of the variable in var More...
 
virtual void saved_value_to_string (THD *thd, set_var *var, char *def_val)
 This function converts value stored in save_result to string. More...
 
virtual void global_save_default (THD *, set_var *)
 save the global default value of the variable in var More...
 
bool session_update (THD *thd, set_var *var)
 
bool global_update (THD *thd, set_var *var)
 
bool is_default (THD *thd, set_var *var)
 
longlong get_min_value ()
 
ulonglong get_max_value ()
 
void set_arg_source (get_opt_arg_source *src)
 
bool is_non_persistent ()
 
void set_is_plugin (bool val)
 
- Public Member Functions inherited from sys_var
 sys_var (sys_var_chain *chain, const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, int getopt_id, enum get_opt_arg_type getopt_arg_type, SHOW_TYPE show_val_type_arg, longlong 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)
 sys_var constructor More...
 
virtual ~sys_var ()
 
virtual void cleanup ()
 All the cleanup procedures should be performed here. More...
 
bool check (THD *thd, set_var *var)
 
const ucharvalue_ptr (THD *running_thd, THD *target_thd, enum_var_type type, LEX_STRING *base)
 
const ucharvalue_ptr (THD *thd, enum_var_type type, LEX_STRING *base)
 
virtual void update_default (longlong new_def_value)
 
longlong get_default ()
 
virtual ulong get_var_type ()
 Returns variable type. More...
 
enum_variable_source get_source ()
 
const char * get_source_name ()
 
void set_source (enum_variable_source src)
 
bool set_source_name (const char *path)
 
bool set_user (const char *usr)
 
const char * get_user ()
 
const char * get_host ()
 
bool set_host (const char *hst)
 
ulonglong get_timestamp () const
 
void set_user_host (THD *thd)
 
my_optionget_option ()
 
void set_timestamp ()
 
void set_timestamp (ulonglong ts)
 
void clear_user_host_timestamp ()
 
bool set_default (THD *thd, set_var *var)
 Update the system variable with the default value from either session or global scope. More...
 
bool update (THD *thd, set_var *var)
 
SHOW_TYPE show_type ()
 
int scope () const
 
const CHARSET_INFOcharset (THD *thd)
 
bool is_readonly () const
 
bool not_visible () const
 
bool is_trilevel () const
 
bool is_persist_readonly () const
 
bool is_hint_updateable () const
 Check if the variable can be set using SET_VAR hint. More...
 
bool is_struct ()
 the following is only true for keycache variables, that support the syntax @keycache_name.variable_name More...
 
bool is_written_to_binlog (enum_var_type type)
 
bool check_scope (enum_var_type query_type)
 Return true for success if: Global query and variable scope is GLOBAL or SESSION, or Session query and variable scope is SESSION or ONLY_SESSION. More...
 
bool is_global_persist (enum_var_type type)
 
bool is_settable_at_command_line ()
 Return true if settable at the command line. More...
 
bool register_option (std::vector< my_option > *array, int parse_flags)
 
void do_deprecated_warning (THD *thd)
 
Itemcopy_value (THD *thd)
 Create item from system variable value. More...
 
void save_default (THD *thd, set_var *var)
 

Static Public Member Functions

static void * operator new (size_t size, MEM_ROOT *mem_root, const std::nothrow_t &arg=std::nothrow) noexcept
 
static void * operator new (size_t size)
 
static void operator delete (void *ptr_arg, size_t size)
 
static void operator delete (void *, MEM_ROOT *, const std::nothrow_t &) noexcept
 
static void operator delete (void *ptr)
 

Public Attributes

bool is_plugin
 
st_plugin_intplugin
 
SYS_VARplugin_var
 
const char * orig_pluginvar_name
 variable name from whatever is hard-coded in the plugin source and doesn't have pluginname- prefix is replaced by an allocated name with a plugin prefix. More...
 
- Public Attributes inherited from sys_var
sys_varnext
 
LEX_CSTRING name
 
enum sys_var::binlog_status_enum binlog_status
 

Static Private Member Functions

static bool on_check_pluginvar (sys_var *self, THD *, set_var *var)
 Enforce the NO DEFAULT policy for plugin system variables. More...
 

Additional Inherited Members

- Public Types inherited from sys_var
enum  flag_enum {
  GLOBAL = 0x0001, SESSION = 0x0002, ONLY_SESSION = 0x0004, SCOPE_MASK = 0x03FF,
  READONLY = 0x0400, ALLOCATED = 0x0800, INVISIBLE = 0x1000, TRI_LEVEL = 0x2000,
  NOTPERSIST = 0x4000, HINT_UPDATEABLE = 0x8000, PERSIST_AS_READ_ONLY = 0x10000
}
 
enum  binlog_status_enum { VARIABLE_NOT_IN_BINLOG, SESSION_VARIABLE_IN_BINLOG }
 Enumeration type to indicate for a system variable whether it will be written to the binlog or not. More...
 
- Static Public Attributes inherited from sys_var
static const int PARSE_EARLY = 1
 
static const int PARSE_NORMAL = 2
 
- Protected Types inherited from sys_var
typedef bool(* on_check_function) (sys_var *self, THD *thd, set_var *var)
 
typedef bool(* on_update_function) (sys_var *self, THD *thd, enum_var_type type)
 
- Protected Member Functions inherited from sys_var
ucharsession_var_ptr (THD *thd)
 A pointer to a storage area of the variable, to the raw data. More...
 
ucharglobal_var_ptr ()
 
- Protected Attributes inherited from sys_var
int flags
 or'ed flag_enum values More...
 
int m_parse_flag
 either PARSE_EARLY or PARSE_NORMAL. More...
 
const SHOW_TYPE show_val_type
 what value_ptr() returns for sql_show.cc More...
 
my_option option
 min, max, default values are stored here More...
 
PolyLockguard
 second lock that protects the variable More...
 
ptrdiff_t offset
 offset to the value from global_system_variables More...
 
on_check_function on_check
 
on_update_function on_update
 
const char *const deprecation_substitute
 
bool is_os_charset
 true if the value is in character_set_filesystem More...
 
struct get_opt_arg_source source
 
char user [USERNAME_CHAR_LENGTH+1]
 
char host [HOSTNAME_LENGTH+1]
 
ulonglong timestamp
 

Constructor & Destructor Documentation

◆ sys_var_pluginvar()

sys_var_pluginvar::sys_var_pluginvar ( sys_var_chain chain,
const char *  name_arg,
SYS_VAR plugin_var_arg 
)
inline

Member Function Documentation

◆ cast_pluginvar()

sys_var_pluginvar* sys_var_pluginvar::cast_pluginvar ( )
inlinevirtual

downcast for sys_var_pluginvar.

Returns this if it's an instance of sys_var_pluginvar, and 0 otherwise.

Reimplemented from sys_var.

◆ check_update_type()

bool sys_var_pluginvar::check_update_type ( Item_result  type)
virtual

Implements sys_var.

◆ do_check()

bool sys_var_pluginvar::do_check ( THD thd,
set_var var 
)
virtual

Implements sys_var.

◆ do_value_ptr() [1/2]

uchar * sys_var_pluginvar::do_value_ptr ( THD running_thd,
THD target_thd,
enum_var_type  type,
LEX_STRING base 
)

◆ do_value_ptr() [2/2]

uchar* sys_var_pluginvar::do_value_ptr ( THD thd,
enum_var_type  type,
LEX_STRING base 
)
inline

◆ get_max_value()

ulonglong sys_var_pluginvar::get_max_value ( )
virtual

Reimplemented from sys_var.

◆ get_min_value()

longlong sys_var_pluginvar::get_min_value ( )
virtual

Reimplemented from sys_var.

◆ global_save_default()

virtual void sys_var_pluginvar::global_save_default ( THD thd,
set_var var 
)
inlinevirtual

save the global default value of the variable in var

Implements sys_var.

◆ global_update()

bool sys_var_pluginvar::global_update ( THD thd,
set_var var 
)
virtual

Implements sys_var.

◆ global_value_ptr()

const uchar* sys_var_pluginvar::global_value_ptr ( THD thd,
LEX_STRING base 
)
inlinevirtual

Reimplemented from sys_var.

◆ is_default()

bool sys_var_pluginvar::is_default ( THD thd,
set_var var 
)
virtual

Reimplemented from sys_var.

◆ is_non_persistent()

bool sys_var_pluginvar::is_non_persistent ( )
inlinevirtual

Reimplemented from sys_var.

◆ on_check_pluginvar()

bool sys_var_pluginvar::on_check_pluginvar ( sys_var self,
THD ,
set_var var 
)
staticprivate

Enforce the NO DEFAULT policy for plugin system variables.

A plugin variable does not explicitly call the plugin supplied check function when setting the default value, e.g. SET <plugin_var> = DEFAULT.

But when the PLUGIN_VAR_NODEFAULT is set setting the default value is prohibited. This function gets called after the actual check done by sys_var_pluginvar::do_check() so it does not need to check again.

it only needs to enforce the PLUGIN_VAR_NODEFAULT flag.

There's no need for special error hence just returning true is enough.

See also
sys_var::on_check_function, sys_var::check, sys_var_pluginvar::do_check(), PLUGIN_VAR_NODEFAULT
Parameters
selfthe sys_var structure for the variable being set
varthe data about the value being set
Returns
is the setting valid
Return values
truenot valid
falsevalid

◆ operator delete() [1/3]

static void sys_var_pluginvar::operator delete ( void *  ptr_arg,
size_t  size 
)
inlinestatic

◆ operator delete() [2/3]

static void sys_var_pluginvar::operator delete ( void *  ,
MEM_ROOT ,
const std::nothrow_t &   
)
inlinestaticnoexcept

◆ operator delete() [3/3]

static void sys_var_pluginvar::operator delete ( void *  ptr)
inlinestatic

◆ operator new() [1/2]

static void* sys_var_pluginvar::operator new ( size_t  size,
MEM_ROOT mem_root,
const std::nothrow_t &  arg = std::nothrow 
)
inlinestaticnoexcept

◆ operator new() [2/2]

static void* sys_var_pluginvar::operator new ( size_t  size)
inlinestatic

◆ plugin_var_typelib()

TYPELIB * sys_var_pluginvar::plugin_var_typelib ( void  )

◆ real_value_ptr()

uchar * sys_var_pluginvar::real_value_ptr ( THD thd,
enum_var_type  type 
)

◆ saved_value_to_string()

void sys_var_pluginvar::saved_value_to_string ( THD thd,
set_var var,
char *  def_val 
)
virtual

This function converts value stored in save_result to string.

This function must ba called after calling save_default() as save_default() will store default value to save_result.

Implements sys_var.

◆ session_save_default()

virtual void sys_var_pluginvar::session_save_default ( THD thd,
set_var var 
)
inlinevirtual

save the session default value of the variable in var

Implements sys_var.

◆ session_update()

bool sys_var_pluginvar::session_update ( THD thd,
set_var var 
)
virtual

Implements sys_var.

◆ session_value_ptr()

const uchar* sys_var_pluginvar::session_value_ptr ( THD running_thd,
THD target_thd,
LEX_STRING base 
)
inlinevirtual

A pointer to a value of the variable for SHOW.

It must be of show_val_type type (bool for SHOW_BOOL, int for SHOW_INT, longlong for SHOW_LONGLONG, etc).

Reimplemented from sys_var.

◆ set_arg_source()

void sys_var_pluginvar::set_arg_source ( get_opt_arg_source src)
inlinevirtual

Reimplemented from sys_var.

◆ set_is_plugin()

void sys_var_pluginvar::set_is_plugin ( bool  val)
inlinevirtual

Reimplemented from sys_var.

◆ show_type()

SHOW_TYPE sys_var_pluginvar::show_type ( )

Member Data Documentation

◆ is_plugin

bool sys_var_pluginvar::is_plugin

◆ orig_pluginvar_name

const char* sys_var_pluginvar::orig_pluginvar_name

variable name from whatever is hard-coded in the plugin source and doesn't have pluginname- prefix is replaced by an allocated name with a plugin prefix.

When plugin is uninstalled we need to restore the pointer to point to the hard-coded value, because plugin may be installed/uninstalled many times without reloading the shared object.

◆ plugin

st_plugin_int* sys_var_pluginvar::plugin

◆ plugin_var

SYS_VAR* sys_var_pluginvar::plugin_var

The documentation for this class was generated from the following files: