24#ifndef _sql_comp_common_h
25#define _sql_comp_common_h
56#define OPTION_SET_LIMITS(type, options, opt) \
57 options->var_type = type; \
58 options->def_value = (opt)->def_val; \
59 options->min_value = (opt)->min_val; \
60 options->max_value = (opt)->max_val; \
61 options->block_size = (long)(opt)->blk_sz
63#define OPTION_SET_LIMITS_DOUBLE(options, opt) \
64 options->var_type = GET_DOUBLE; \
65 options->def_value = (longlong)getopt_double2ulonglong((opt)->def_val); \
66 options->min_value = (longlong)getopt_double2ulonglong((opt)->min_val); \
67 options->max_value = getopt_double2ulonglong((opt)->max_val); \
68 options->block_size = (long)(opt)->blk_sz;
74#undef MYSQL_SYSVAR_NAME
75#define MYSQL_SYSVAR_NAME(name) name
76#define PLUGIN_VAR_TYPEMASK 0x007f
77#define PLUGIN_VAR_WITH_SIGN_TYPEMASK 0x00ff
79#define EXTRA_OPTIONS 3
190 if (*
p ==
'_') *
p =
'-';
213 const std::nothrow_t &arg
214 [[maybe_unused]] = std::nothrow)
noexcept {
218 static void *
operator new(
size_t size) {
222 static void operator delete(
void *ptr_arg [[maybe_unused]],
223 size_t size [[maybe_unused]]) {
224 TRASH(ptr_arg, size);
227 static void operator delete(
228 void *,
MEM_ROOT *,
const std::nothrow_t &)
noexcept {
231 static void operator delete(
void *ptr) {
my_free(ptr); }
236 chain, name_arg, plugin_var_arg->
comment,
268 std::string_view keycache_name);
270 std::string_view keycache_name) {
274 std::string_view keycache_name)
override {
278 std::string_view keycache_name)
override {
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:853
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
std::unordered_map, but with my_malloc, so that you can track the memory used using PSI memory keys.
Definition: map_helpers.h:148
set_var_base descendant for assignments to the system variables.
Definition: set_var.h:971
Definition: sql_plugin_var.h:196
TYPELIB * plugin_var_typelib(void)
Definition: sql_plugin_var.cc:291
SYS_VAR * plugin_var
Definition: sql_plugin_var.h:202
uchar * do_value_ptr(THD *thd, enum_var_type type, std::string_view keycache_name)
Definition: sql_plugin_var.h:269
bool is_plugin
Definition: sql_plugin_var.h:200
void set_arg_source(get_opt_arg_source *src) override
Definition: sql_plugin_var.h:289
void global_save_default(THD *, set_var *) override
save the global default value of the variable in var
Definition: sql_plugin_var.h:284
void session_save_default(THD *, set_var *) override
save the session default value of the variable in var
Definition: sql_plugin_var.h:282
bool is_non_persistent() override
Definition: sql_plugin_var.h:293
sys_var_pluginvar(sys_var_chain *chain, const char *name_arg, SYS_VAR *plugin_var_arg)
Definition: sql_plugin_var.h:233
st_plugin_int * plugin
Definition: sql_plugin_var.h:201
bool session_update(THD *thd, set_var *var) override
Definition: sql_plugin_var.cc:336
ulonglong get_max_value() override
Definition: sql_plugin_var.cc:457
const uchar * session_value_ptr(THD *running_thd, THD *target_thd, std::string_view keycache_name) override
A pointer to a value of the variable for SHOW.
Definition: sql_plugin_var.h:273
bool check_update_type(Item_result type) override
Definition: sql_plugin_var.cc:260
void set_is_plugin(bool val) override
Definition: sql_plugin_var.h:296
uchar * do_value_ptr(THD *running_thd, THD *target_thd, enum_var_type type, std::string_view keycache_name)
Definition: sql_plugin_var.cc:307
const uchar * global_value_ptr(THD *thd, std::string_view keycache_name) override
Definition: sql_plugin_var.h:277
const char * orig_pluginvar_name
variable name from whatever is hard-coded in the plugin source and doesn't have pluginname- prefix is...
Definition: sql_plugin_var.h:210
void saved_value_to_string(THD *thd, set_var *var, char *def_val) override
This function converts value stored in save_result to string.
Definition: sql_plugin_var.cc:511
uchar * real_value_ptr(THD *thd, enum_var_type type)
Definition: sql_plugin_var.cc:280
sys_var_pluginvar * cast_pluginvar() override
downcast for sys_var_pluginvar.
Definition: sql_plugin_var.h:262
longlong get_min_value() override
Definition: sql_plugin_var.cc:435
static bool on_check_pluginvar(sys_var *self, THD *, set_var *var)
Enforce the NO DEFAULT policy for plugin system variables.
Definition: sql_plugin_var.cc:503
bool do_check(THD *thd, set_var *var) override
Definition: sql_plugin_var.cc:322
bool global_update(THD *thd, set_var *var) override
Definition: sql_plugin_var.cc:359
A class representing one system variable - that is something that can be accessed as @global....
Definition: set_var.h:105
LEX_CSTRING name
Definition: set_var.h:108
@ SESSION
Definition: set_var.h:128
@ GLOBAL
Definition: set_var.h:127
@ INVISIBLE
Definition: set_var.h:133
@ SENSITIVE
Sensitive variable.
Definition: set_var.h:151
@ READONLY
Definition: set_var.h:131
@ PERSIST_AS_READ_ONLY
There can be some variables which needs to be set before plugin is loaded.
Definition: set_var.h:146
@ VARIABLE_NOT_IN_BINLOG
Definition: set_var.h:160
struct get_opt_arg_source source
Definition: set_var.h:185
int flags
or'ed flag_enum values
Definition: set_var.h:170
static const int PARSE_NORMAL
Definition: set_var.h:154
static MEM_ROOT mem_root
Definition: client_plugin.cc:110
const char * p
Definition: ctype-mb.cc:1237
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:222
#define PLUGIN_VAR_OPCMDARG
Argument optional for cmd line.
Definition: system_variables_bits.h:70
#define PLUGIN_VAR_NOPERSIST
SET PERSIST_ONLY is prohibited for read only variables.
Definition: system_variables_bits.h:73
#define PLUGIN_VAR_THDLOCAL
Variable is per-connection.
Definition: system_variables_bits.h:64
#define PLUGIN_VAR_RQCMDARG
Argument required for cmd line.
Definition: system_variables_bits.h:69
#define PLUGIN_VAR_READONLY
Server variable is read only.
Definition: system_variables_bits.h:65
#define PLUGIN_VAR_NOCMDOPT
Not a command line option.
Definition: system_variables_bits.h:67
#define PLUGIN_VAR_SENSITIVE
Sensitive variable.
Definition: system_variables_bits.h:77
#define PLUGIN_VAR_NOCMDARG
No argument for cmd line.
Definition: system_variables_bits.h:68
#define PLUGIN_VAR_PERSIST_AS_READ_ONLY
Definition: system_variables_bits.h:75
#define PLUGIN_VAR_INVISIBLE
Variable should not be shown.
Definition: system_variables_bits.h:76
#define PLUGIN_VAR_NODEFAULT
SET DEFAULT is prohibited.
Definition: system_variables_bits.h:71
static int flags[50]
Definition: hp_test1.cc:40
#define comment
Definition: lexyy.cc:959
Various macros useful for communicating with memory debuggers, such as Valgrind.
void TRASH(void *ptr, size_t length)
Put bad content in memory to be sure it will segfault if dereferenced.
Definition: memory_debugging.h:71
Header for compiler-dependent features.
@ OPT_ARG
Definition: my_getopt.h:81
@ REQUIRED_ARG
Definition: my_getopt.h:81
@ NO_ARG
Definition: my_getopt.h:81
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
long long int longlong
Definition: my_inttypes.h:55
#define MYF(v)
Definition: my_inttypes.h:97
void * my_malloc(PSI_memory_key key, size_t size, int flags)
Allocates size bytes of memory.
Definition: my_memory.cc:57
void my_free(void *ptr)
Frees the memory pointed by the ptr.
Definition: my_memory.cc:81
Common header for many mysys elements.
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1052
Definition: buf0block_hint.cc:30
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:420
Performance schema instrumentation interface.
required string type
Definition: replication_group_member_actions.proto:34
"public" interface to sys_var - server configuration variables.
enum enum_mysql_show_type SHOW_TYPE
Definition: set_var.h:73
enum_var_type
Definition: set_var.h:90
@ OPT_GLOBAL
Definition: set_var.h:93
@ OPT_SESSION
Definition: set_var.h:92
int check_func_str(THD *thd, SYS_VAR *, void *save, st_mysql_value *value)
Definition: sql_plugin_var.cc:683
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_int_t, int)
typedef DECLARE_MYSQL_SYSVAR_BASIC(sysvar_bool_t, bool)
const char * item_val_str(st_mysql_value *value, char *buffer, int *length)
Definition: sql_plugin_var.cc:227
malloc_unordered_map< std::string, st_bookmark * > * get_bookmark_hash()
Definition: sql_plugin.cc:503
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.
Definition: sql_plugin_var.cc:120
int check_func_bool(THD *, SYS_VAR *, void *save, st_mysql_value *value)
Definition: sql_plugin_var.cc:597
void update_func_long(THD *, SYS_VAR *, void *tgt, const void *save)
Definition: sql_plugin_var.cc:778
void update_func_bool(THD *, SYS_VAR *, void *tgt, const void *save)
Definition: sql_plugin_var.cc:770
st_bookmark * find_bookmark(const char *plugin, const char *name, int flags)
Definition: sql_plugin_var.cc:799
int check_func_enum(THD *, SYS_VAR *var, void *save, st_mysql_value *value)
Definition: sql_plugin_var.cc:695
typedef DECLARE_MYSQL_THDVAR_BASIC(thdvar_bool_t, bool)
void update_func_double(THD *, SYS_VAR *, void *tgt, const void *save)
Definition: sql_plugin_var.cc:790
int check_func_long(THD *thd, SYS_VAR *var, void *save, st_mysql_value *value)
Definition: sql_plugin_var.cc:640
typedef DECLARE_MYSQL_THDVAR_TYPELIB(thdvar_enum_t, unsigned long)
SHOW_TYPE pluginvar_show_type(SYS_VAR *plugin_var)
Definition: sql_plugin_var.cc:155
void update_func_longlong(THD *, SYS_VAR *, void *tgt, const void *save)
Definition: sql_plugin_var.cc:782
int check_func_set(THD *, SYS_VAR *var, void *save, st_mysql_value *value)
Definition: sql_plugin_var.cc:724
void update_func_int(THD *, SYS_VAR *, void *tgt, const void *save)
Definition: sql_plugin_var.cc:774
void update_func_str(THD *, SYS_VAR *, void *tgt, const void *save)
Definition: sql_plugin_var.cc:786
int check_func_longlong(THD *thd, SYS_VAR *var, void *save, st_mysql_value *value)
Definition: sql_plugin_var.cc:661
int item_val_int(st_mysql_value *value, long long *buf)
Definition: sql_plugin_var.cc:241
uchar * intern_sys_var_ptr(THD *thd, int offset, bool global_lock)
Definition: sql_plugin_var.cc:190
int check_func_int(THD *thd, SYS_VAR *var, void *save, st_mysql_value *value)
Definition: sql_plugin_var.cc:619
int item_is_unsigned(st_mysql_value *value)
Definition: sql_plugin_var.cc:248
int check_func_double(THD *thd, SYS_VAR *var, void *save, st_mysql_value *value)
Definition: sql_plugin_var.cc:757
void convert_underscore_to_dash(char *str, size_t len)
Definition: sql_plugin_var.h:188
int item_val_real(st_mysql_value *value, double *buf)
Definition: sql_plugin_var.cc:253
int item_value_type(st_mysql_value *value)
Definition: sql_plugin_var.cc:216
void plugin_opt_set_limits(struct my_option *, const SYS_VAR *)
Definition: sql_plugin_var.cc:824
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_int_t, int)
typedef DECLARE_MYSQL_SYSVAR_TYPELIB(sysvar_enum_t, unsigned long)
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.
Definition: sql_plugin_var.cc:66
case opt name
Definition: sslopt-case.h:33
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
void * Alloc(size_t length)
Allocate memory.
Definition: my_alloc.h:145
MYSQL_PLUGIN_VAR_HEADER
Definition: plugin.h:68
Definition: my_getopt.h:83
char m_path_name[FN_REFLEN]
config file path OR compiled default values
Definition: my_getopt.h:87
enum enum_variable_source m_source
Definition: my_getopt.h:88
Definition: my_getopt.h:93
Definition: sql_plugin_var.h:172
int offset
Definition: sql_plugin_var.h:174
char key[1]
Definition: sql_plugin_var.h:176
uint version
Definition: sql_plugin_var.h:175
size_t name_len
Definition: sql_plugin_var.h:173
Definition: sql_plugin_var.h:303
Item * item
Definition: sql_plugin_var.h:304
Definition: system_variables_bits.h:94
Definition: sql_plugin_ref.h:45
unsigned int uint
Definition: uca9-dump.cc:75
Item_result
Type of the user defined function return slot and arguments.
Definition: udf_registration_types.h:39
#define PSI_NOT_INSTRUMENTED
Definition: validate_password_imp.cc:42