27#error This header shall not be included in components
33#ifndef MYSQL_ABI_CHECK
52#if defined(MYSQL_DYNAMIC_PLUGIN)
54#define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport)
56#define MYSQL_PLUGIN_EXPORT __declspec(dllexport)
60#define MYSQL_PLUGIN_EXPORT extern "C"
62#define MYSQL_PLUGIN_EXPORT
68#if defined(MYSQL_DYNAMIC_PLUGIN)
69#define MYSQL_PLUGIN_EXPORT MY_ATTRIBUTE((visibility("default")))
71#define MYSQL_PLUGIN_EXPORT
79#define MYSQL_THD THD *
81#define MYSQL_THD void *
86#ifndef MYSQL_ABI_CHECK
90#define MYSQL_XIDDATASIZE 128
110#define MYSQL_PLUGIN_INTERFACE_VERSION 0x010B
115#define MYSQL_UDF_PLUGIN 0
116#define MYSQL_STORAGE_ENGINE_PLUGIN 1
117#define MYSQL_FTPARSER_PLUGIN 2
118#define MYSQL_DAEMON_PLUGIN 3
119#define MYSQL_INFORMATION_SCHEMA_PLUGIN 4
120#define MYSQL_AUDIT_PLUGIN 5
121#define MYSQL_REPLICATION_PLUGIN 6
122#define MYSQL_AUTHENTICATION_PLUGIN 7
123#define MYSQL_VALIDATE_PASSWORD_PLUGIN 8
124#define MYSQL_GROUP_REPLICATION_PLUGIN 9
125#define MYSQL_KEYRING_PLUGIN 10
126#define MYSQL_CLONE_PLUGIN 11
127#define MYSQL_MAX_PLUGIN_TYPE_NUM 12
130#define PLUGIN_LICENSE_PROPRIETARY 0
131#define PLUGIN_LICENSE_GPL 1
132#define PLUGIN_LICENSE_BSD 2
134#define PLUGIN_LICENSE_PROPRIETARY_STRING "PROPRIETARY"
135#define PLUGIN_LICENSE_GPL_STRING "GPL"
136#define PLUGIN_LICENSE_BSD_STRING "BSD"
138#define PLUGIN_AUTHOR_ORACLE "Oracle Corporation"
146#ifndef MYSQL_DYNAMIC_PLUGIN
147#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \
148 MYSQL_PLUGIN_EXPORT int VERSION = MYSQL_PLUGIN_INTERFACE_VERSION; \
149 MYSQL_PLUGIN_EXPORT int PSIZE = sizeof(struct st_mysql_plugin); \
150 MYSQL_PLUGIN_EXPORT struct st_mysql_plugin DECLS[] = {
152#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \
153 MYSQL_PLUGIN_EXPORT int _mysql_plugin_interface_version_ = \
154 MYSQL_PLUGIN_INTERFACE_VERSION; \
155 MYSQL_PLUGIN_EXPORT int _mysql_sizeof_struct_st_plugin_ = \
156 sizeof(struct st_mysql_plugin); \
157 MYSQL_PLUGIN_EXPORT struct st_mysql_plugin _mysql_plugin_declarations_[] = {
160#define mysql_declare_plugin(NAME) \
161 __MYSQL_DECLARE_PLUGIN(NAME, builtin_##NAME##_plugin_interface_version, \
162 builtin_##NAME##_sizeof_struct_st_plugin, \
163 builtin_##NAME##_plugin)
165#define mysql_declare_plugin_end \
167 0, nullptr, nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr, 0, \
168 nullptr, nullptr, nullptr, 0 \
176#define PLUGIN_OPT_NO_INSTALL 1UL
177#define PLUGIN_OPT_NO_UNINSTALL 2UL
178#define PLUGIN_OPT_ALLOW_EARLY 4UL
179#define PLUGIN_OPT_DEFAULT_OFF 8UL
191#define PLUGIN_OPT_DEPENDENT_EXTRA_PLUGINS 16UL
201#define PLUGIN_VAR_MASK \
202 (PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT | \
203 PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | \
204 PLUGIN_VAR_MEMALLOC | PLUGIN_VAR_NODEFAULT | PLUGIN_VAR_NOPERSIST | \
205 PLUGIN_VAR_PERSIST_AS_READ_ONLY | PLUGIN_VAR_INVISIBLE | \
206 PLUGIN_VAR_SENSITIVE)
208#define MYSQL_PLUGIN_VAR_HEADER \
211 const char *comment; \
212 mysql_var_check_func check; \
213 mysql_var_update_func update
215#define MYSQL_SYSVAR_NAME(name) mysql_sysvar_##name
216#define MYSQL_SYSVAR(name) ((SYS_VAR *)&(MYSQL_SYSVAR_NAME(name)))
225#define DECLARE_MYSQL_SYSVAR_BASIC(name, type) \
227 MYSQL_PLUGIN_VAR_HEADER; \
229 const type def_val; \
230 } MYSQL_SYSVAR_NAME(name)
232#define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) \
234 MYSQL_PLUGIN_VAR_HEADER; \
240 } MYSQL_SYSVAR_NAME(name)
242#define DECLARE_MYSQL_SYSVAR_TYPELIB(name, type) \
244 MYSQL_PLUGIN_VAR_HEADER; \
248 } MYSQL_SYSVAR_NAME(name)
250#define DECLARE_THDVAR_FUNC(type) type *(*resolve)(MYSQL_THD thd, int offset)
252#define DECLARE_MYSQL_THDVAR_BASIC(name, type) \
254 MYSQL_PLUGIN_VAR_HEADER; \
256 const type def_val; \
257 DECLARE_THDVAR_FUNC(type); \
258 } MYSQL_SYSVAR_NAME(name)
260#define DECLARE_MYSQL_THDVAR_SIMPLE(name, type) \
262 MYSQL_PLUGIN_VAR_HEADER; \
268 DECLARE_THDVAR_FUNC(type); \
269 } MYSQL_SYSVAR_NAME(name)
271#define DECLARE_MYSQL_THDVAR_TYPELIB(name, type) \
273 MYSQL_PLUGIN_VAR_HEADER; \
276 DECLARE_THDVAR_FUNC(type); \
278 } MYSQL_SYSVAR_NAME(name)
284#define MYSQL_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
285 DECLARE_MYSQL_SYSVAR_BASIC(name, bool) = { \
286 PLUGIN_VAR_BOOL | ((opt)&PLUGIN_VAR_MASK), \
294#define MYSQL_SYSVAR_STR(name, varname, opt, comment, check, update, def) \
295 DECLARE_MYSQL_SYSVAR_BASIC(name, char *) = { \
296 PLUGIN_VAR_STR | ((opt)&PLUGIN_VAR_MASK), \
304#define MYSQL_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, \
306 DECLARE_MYSQL_SYSVAR_SIMPLE(name, int) = { \
307 PLUGIN_VAR_INT | ((opt)&PLUGIN_VAR_MASK), \
318#define MYSQL_SYSVAR_UINT(name, varname, opt, comment, check, update, def, \
320 DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned int) = { \
321 PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt)&PLUGIN_VAR_MASK), \
332#define MYSQL_SYSVAR_LONG(name, varname, opt, comment, check, update, def, \
334 DECLARE_MYSQL_SYSVAR_SIMPLE(name, long) = { \
335 PLUGIN_VAR_LONG | ((opt)&PLUGIN_VAR_MASK), \
346#define MYSQL_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, \
348 DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long) = { \
349 PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt)&PLUGIN_VAR_MASK), \
360#define MYSQL_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, \
362 DECLARE_MYSQL_SYSVAR_SIMPLE(name, long long) = { \
363 PLUGIN_VAR_LONGLONG | ((opt)&PLUGIN_VAR_MASK), \
374#define MYSQL_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, \
375 def, min, max, blk) \
376 DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long long) = { \
377 PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt)&PLUGIN_VAR_MASK), \
388#define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, \
390 DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \
391 PLUGIN_VAR_ENUM | ((opt)&PLUGIN_VAR_MASK), \
400#define MYSQL_SYSVAR_SET(name, varname, opt, comment, check, update, def, \
402 DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long long) = { \
403 PLUGIN_VAR_SET | ((opt)&PLUGIN_VAR_MASK), \
412#define MYSQL_SYSVAR_DOUBLE(name, varname, opt, comment, check, update, def, \
414 DECLARE_MYSQL_SYSVAR_SIMPLE(name, double) = { \
415 PLUGIN_VAR_DOUBLE | ((opt)&PLUGIN_VAR_MASK), \
426#define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \
427 DECLARE_MYSQL_THDVAR_BASIC(name, bool) = { \
428 PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt)&PLUGIN_VAR_MASK), \
437#define MYSQL_THDVAR_STR(name, opt, comment, check, update, def) \
438 DECLARE_MYSQL_THDVAR_BASIC(name, char *) = { \
439 PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | ((opt)&PLUGIN_VAR_MASK), \
448#define MYSQL_THDVAR_INT(name, opt, comment, check, update, def, min, max, \
450 DECLARE_MYSQL_THDVAR_SIMPLE(name, int) = { \
451 PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | ((opt)&PLUGIN_VAR_MASK), \
463#define MYSQL_THDVAR_UINT(name, opt, comment, check, update, def, min, max, \
465 DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned int) = { \
466 PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | \
467 ((opt)&PLUGIN_VAR_MASK), \
479#define MYSQL_THDVAR_LONG(name, opt, comment, check, update, def, min, max, \
481 DECLARE_MYSQL_THDVAR_SIMPLE(name, long) = { \
482 PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | ((opt)&PLUGIN_VAR_MASK), \
494#define MYSQL_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, \
496 DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long) = { \
497 PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | \
498 ((opt)&PLUGIN_VAR_MASK), \
510#define MYSQL_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, \
512 DECLARE_MYSQL_THDVAR_SIMPLE(name, long long) = { \
513 PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt)&PLUGIN_VAR_MASK), \
525#define MYSQL_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, \
527 DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long long) = { \
528 PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | \
529 ((opt)&PLUGIN_VAR_MASK), \
541#define MYSQL_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \
542 DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long) = { \
543 PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt)&PLUGIN_VAR_MASK), \
553#define MYSQL_THDVAR_SET(name, opt, comment, check, update, def, typelib) \
554 DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long long) = { \
555 PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt)&PLUGIN_VAR_MASK), \
565#define MYSQL_THDVAR_DOUBLE(name, opt, comment, check, update, def, min, max, \
567 DECLARE_MYSQL_THDVAR_SIMPLE(name, double) = { \
568 PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL | ((opt)&PLUGIN_VAR_MASK), \
582#define SYSVAR(name) (*(MYSQL_SYSVAR_NAME(name).value))
585#define THDVAR(thd, name) \
586 (*(MYSQL_SYSVAR_NAME(name).resolve(thd, MYSQL_SYSVAR_NAME(name).offset)))
588#define THDVAR_SET(thd, name, value) \
589 plugin_thdvar_safe_update(thd, MYSQL_SYSVAR(name), \
590 (char **)&THDVAR(thd, name), (const char *)value);
619#define MYSQL_FTPARSER_INTERFACE_VERSION 0x0101
625#define MYSQL_REWRITE_PRE_PARSE_INTERFACE_VERSION 0x0010
626#define MYSQL_REWRITE_POST_PARSE_INTERFACE_VERSION 0x0010
633#define MYSQL_DAEMON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
649#define MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
665#define MYSQL_HANDLERTON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
682#define MYSQL_REPLICATION_INTERFACE_VERSION 0x0400
695#define thd_proc_info(thd, msg) \
696 set_thd_proc_info(thd, msg, __func__, __FILE__, __LINE__)
707 const char *calling_func,
708 const char *calling_file,
709 const unsigned int calling_line);
718 size_t max_query_len);
781 unsigned long long *pos_var);
826 const void *ha_data);
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:930
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
void thd_binlog_pos(const MYSQL_THD thd, const char **file_var, unsigned long long *pos_var)
Get binary log position for latest written entry.
Definition: sql_thd_api.cc:330
int thd_in_lock_tables(const MYSQL_THD thd)
Definition: sql_thd_api.cc:339
int thd_tx_is_read_only(const MYSQL_THD thd)
Definition: sql_thd_api.cc:427
unsigned long thd_get_thread_id(const MYSQL_THD thd)
Return the thread id of a user thread.
Definition: sql_thd_api.cc:592
int thd_allow_batch(MYSQL_THD thd)
Check if batching is allowed for the thread.
Definition: sql_thd_api.cc:603
#define MYSQL_THD
Definition: plugin.h:79
int thd_tx_is_dd_trx(const MYSQL_THD thd)
Definition: sql_thd_api.cc:452
char * thd_security_context(MYSQL_THD thd, char *buffer, size_t length, size_t max_query_len)
Dumps a text description of a thread, its security context (user, host) and the current query.
Definition: sql_thd_api.cc:499
int mysql_tmpfile(const char *prefix)
Create a temporary file.
Definition: sql_thd_api.cc:335
void thd_inc_row_count(MYSQL_THD thd)
Definition: sql_thd_api.cc:456
void remove_ssl_err_thread_state()
Interface to remove the per thread openssl error queue.
Definition: sql_thd_api.cc:726
int thd_sql_command(const MYSQL_THD thd)
Definition: sql_thd_api.cc:423
#define MYSQL_XIDDATASIZE
Definition: plugin.h:90
int thd_tx_priority(const MYSQL_THD thd)
Definition: sql_thd_api.cc:437
int thd_tx_isolation(const MYSQL_THD thd)
Definition: sql_thd_api.cc:425
const char * set_thd_proc_info(MYSQL_THD thd, const char *info, const char *calling_func, const char *calling_file, const unsigned int calling_line)
Definition: sql_thd_api.cc:372
void * thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton)
Provide a handler data getter to simplify coding.
Definition: sql_thd_api.cc:399
void * MYSQL_PLUGIN
Definition: plugin.h:84
int thd_tablespace_op(const MYSQL_THD thd)
Definition: sql_thd_api.cc:341
int thd_killed(const void *v_thd)
Check the killed state of a connection.
Definition: sql_thd_api.cc:577
void thd_storage_lock_wait(MYSQL_THD thd, long long value)
Definition: sql_thd_api.cc:392
void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton, const void *ha_data)
Provide a handler data setter to simplify coding.
Definition: sql_thd_api.cc:407
void thd_set_kill_status(const MYSQL_THD thd)
Set the killed status of the current statement.
Definition: sql_thd_api.cc:590
void ** thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton)
Definition: sql_thd_api.cc:388
void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid)
Get the XID for this connection's transaction.
Definition: sql_thd_api.cc:572
MYSQL_THD thd_tx_arbitrate(MYSQL_THD requestor, MYSQL_THD holder)
Definition: sql_thd_api.cc:441
void thd_mark_transaction_to_rollback(MYSQL_THD thd, int all)
Mark transaction to rollback and mark error as fatal to a sub-statement if in sub statement mode.
Definition: sql_thd_api.cc:610
long long thd_test_options(const MYSQL_THD thd, long long test_options)
Definition: sql_thd_api.cc:419
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
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
MYSQL_XID is binary compatible with the XID structure as in the X/Open CAE Specification,...
Definition: plugin.h:99
long bqual_length
Definition: plugin.h:102
char data[MYSQL_XIDDATASIZE]
Definition: plugin.h:103
long formatID
Definition: plugin.h:100
long gtrid_length
Definition: plugin.h:101
Replication plugin descriptor.
Definition: plugin.h:687
int interface_version
Definition: plugin.h:688
SHOW STATUS Server status variable.
Definition: status_variables_bits.h:81
Definition: system_variables_bits.h:153
handlerton is a singleton structure - one instance per storage engine - to provide access to storage ...
Definition: handler.h:2765
int interface_version
Definition: plugin.h:641
unsigned int version
Definition: plugin.h:609
int type
Definition: plugin.h:597
SHOW_VAR * status_vars
Definition: plugin.h:610
int(* deinit)(MYSQL_PLUGIN)
Function to invoke when plugin is unloaded.
Definition: plugin.h:608
void * info
Definition: plugin.h:598
int(* check_uninstall)(MYSQL_PLUGIN)
Function to invoke when plugin is uninstalled.
Definition: plugin.h:606
unsigned long flags
Definition: plugin.h:613
int(* init)(MYSQL_PLUGIN)
Function to invoke when plugin is loaded.
Definition: plugin.h:604
const char * descr
Definition: plugin.h:601
const char * author
Definition: plugin.h:600
SYS_VAR ** system_vars
Definition: plugin.h:611
int license
Definition: plugin.h:602
void * __reserved1
Definition: plugin.h:612
const char * name
Definition: plugin.h:599
int interface_version
Definition: plugin.h:674
static int all(site_def const *s, node_no node)
Definition: xcom_transport.cc:890