1
/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
20
On Windows, exports from DLL need to be declared
21
Also, plugin needs to be declared as extern "C" because MSVC
22
unlike other compilers, uses C++ mangling for variables not only
26
#if defined(MYSQL_DYNAMIC_PLUGIN)
28
#define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport)
30
#define MYSQL_PLUGIN_EXPORT __declspec(dllexport)
32
#else /* MYSQL_DYNAMIC_PLUGIN */
34
#define MYSQL_PLUGIN_EXPORT extern "C"
36
#define MYSQL_PLUGIN_EXPORT
38
#endif /*MYSQL_DYNAMIC_PLUGIN */
40
#define MYSQL_PLUGIN_EXPORT
46
#define MYSQL_THD THD*
48
#define MYSQL_THD void*
51
#include <mysql/services.h>
53
#define MYSQL_XIDDATASIZE 128
55
struct st_mysql_xid is binary compatible with the XID structure as
56
in the X/Open CAE Specification, Distributed Transaction Processing:
57
The XA Specification, X/Open Company Ltd., 1991.
58
http://www.opengroup.org/bookstore/catalog/c193.htm
60
@see XID in sql/handler.h
66
char data[MYSQL_XIDDATASIZE]; /* Not \0-terminated */
68
typedef struct st_mysql_xid MYSQL_XID;
70
/*************************************************************************
71
Plugin API. Common for all plugin types.
74
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0103
77
The allowable types of plugins
79
#define MYSQL_UDF_PLUGIN 0 /* User-defined function */
80
#define MYSQL_STORAGE_ENGINE_PLUGIN 1 /* Storage Engine */
81
#define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */
82
#define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */
83
#define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */
84
#define MYSQL_AUDIT_PLUGIN 5 /* The Audit plugin type */
85
#define MYSQL_REPLICATION_PLUGIN 6 /* The replication plugin type */
86
#define MYSQL_AUTHENTICATION_PLUGIN 7 /* The authentication plugin type */
87
#define MYSQL_MAX_PLUGIN_TYPE_NUM 8 /* The number of plugin types */
89
/* We use the following strings to define licenses for plugins */
90
#define PLUGIN_LICENSE_PROPRIETARY 0
91
#define PLUGIN_LICENSE_GPL 1
92
#define PLUGIN_LICENSE_BSD 2
94
#define PLUGIN_LICENSE_PROPRIETARY_STRING "PROPRIETARY"
95
#define PLUGIN_LICENSE_GPL_STRING "GPL"
96
#define PLUGIN_LICENSE_BSD_STRING "BSD"
99
Macros for beginning and ending plugin declarations. Between
100
mysql_declare_plugin and mysql_declare_plugin_end there should
101
be a st_mysql_plugin struct for each plugin to be declared.
105
#ifndef MYSQL_DYNAMIC_PLUGIN
106
#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \
107
MYSQL_PLUGIN_EXPORT int VERSION= MYSQL_PLUGIN_INTERFACE_VERSION; \
108
MYSQL_PLUGIN_EXPORT int PSIZE= sizeof(struct st_mysql_plugin); \
109
MYSQL_PLUGIN_EXPORT struct st_mysql_plugin DECLS[]= {
111
#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \
112
MYSQL_PLUGIN_EXPORT int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION; \
113
MYSQL_PLUGIN_EXPORT int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin); \
114
MYSQL_PLUGIN_EXPORT struct st_mysql_plugin _mysql_plugin_declarations_[]= {
117
#define mysql_declare_plugin(NAME) \
118
__MYSQL_DECLARE_PLUGIN(NAME, \
119
builtin_ ## NAME ## _plugin_interface_version, \
120
builtin_ ## NAME ## _sizeof_struct_st_plugin, \
121
builtin_ ## NAME ## _plugin)
123
#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0,0}}
126
declarations for SHOW STATUS support in plugins
128
enum enum_mysql_show_type
130
SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG,
131
SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
132
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
136
struct st_mysql_show_var {
139
enum enum_mysql_show_type type;
142
#define SHOW_VAR_FUNC_BUFF_SIZE 1024
143
typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *);
147
Constants for plugin flags.
150
#define PLUGIN_OPT_NO_INSTALL 1UL /* Not dynamically loadable */
151
#define PLUGIN_OPT_NO_UNINSTALL 2UL /* Not dynamically unloadable */
155
declarations for server variables and command line options
159
#define PLUGIN_VAR_BOOL 0x0001
160
#define PLUGIN_VAR_INT 0x0002
161
#define PLUGIN_VAR_LONG 0x0003
162
#define PLUGIN_VAR_LONGLONG 0x0004
163
#define PLUGIN_VAR_STR 0x0005
164
#define PLUGIN_VAR_ENUM 0x0006
165
#define PLUGIN_VAR_SET 0x0007
166
#define PLUGIN_VAR_UNSIGNED 0x0080
167
#define PLUGIN_VAR_THDLOCAL 0x0100 /* Variable is per-connection */
168
#define PLUGIN_VAR_READONLY 0x0200 /* Server variable is read only */
169
#define PLUGIN_VAR_NOSYSVAR 0x0400 /* Not a server variable */
170
#define PLUGIN_VAR_NOCMDOPT 0x0800 /* Not a command line option */
171
#define PLUGIN_VAR_NOCMDARG 0x1000 /* No argument for cmd line */
172
#define PLUGIN_VAR_RQCMDARG 0x0000 /* Argument required for cmd line */
173
#define PLUGIN_VAR_OPCMDARG 0x2000 /* Argument optional for cmd line */
174
#define PLUGIN_VAR_MEMALLOC 0x8000 /* String needs memory allocated */
176
struct st_mysql_sys_var;
177
struct st_mysql_value;
181
(*mysql_var_check_func)()
183
var dynamic variable being altered
184
save pointer to temporary storage
185
value user provided value
187
0 user provided value is OK and the update func may be called.
188
any other value indicates error.
190
This function should parse the user provided value and store in the
191
provided temporary storage any data as required by the update func.
192
There is sufficient space in the temporary storage to store a double.
193
Note that the update func may not be called if any other error occurs
194
so any memory allocated should be thread-local so that it may be freed
195
automatically at the end of the statement.
198
typedef int (*mysql_var_check_func)(MYSQL_THD thd,
199
struct st_mysql_sys_var *var,
200
void *save, struct st_mysql_value *value);
204
(*mysql_var_update_func)()
206
var dynamic variable being altered
207
var_ptr pointer to dynamic variable
208
save pointer to temporary storage
212
This function should use the validated value stored in the temporary store
213
and persist it in the provided pointer to the dynamic variable.
214
For example, strings may require memory to be allocated.
216
typedef void (*mysql_var_update_func)(MYSQL_THD thd,
217
struct st_mysql_sys_var *var,
218
void *var_ptr, const void *save);
221
/* the following declarations are for internal use only */
224
#define PLUGIN_VAR_MASK \
225
(PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | \
226
PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \
227
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC)
229
#define MYSQL_PLUGIN_VAR_HEADER \
232
const char *comment; \
233
mysql_var_check_func check; \
234
mysql_var_update_func update
236
#define MYSQL_SYSVAR_NAME(name) mysql_sysvar_ ## name
237
#define MYSQL_SYSVAR(name) \
238
((struct st_mysql_sys_var *)&(MYSQL_SYSVAR_NAME(name)))
241
for global variables, the value pointer is the first
242
element after the header, the default value is the second.
243
for thread variables, the value offset is the first
244
element after the header, the default value is the second.
248
#define DECLARE_MYSQL_SYSVAR_BASIC(name, type) struct { \
249
MYSQL_PLUGIN_VAR_HEADER; \
251
const type def_val; \
252
} MYSQL_SYSVAR_NAME(name)
254
#define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \
255
MYSQL_PLUGIN_VAR_HEADER; \
256
type *value; type def_val; \
257
type min_val; type max_val; \
259
} MYSQL_SYSVAR_NAME(name)
261
#define DECLARE_MYSQL_SYSVAR_TYPELIB(name, type) struct { \
262
MYSQL_PLUGIN_VAR_HEADER; \
263
type *value; type def_val; \
265
} MYSQL_SYSVAR_NAME(name)
267
#define DECLARE_THDVAR_FUNC(type) \
268
type *(*resolve)(MYSQL_THD thd, int offset)
270
#define DECLARE_MYSQL_THDVAR_BASIC(name, type) struct { \
271
MYSQL_PLUGIN_VAR_HEADER; \
273
const type def_val; \
274
DECLARE_THDVAR_FUNC(type); \
275
} MYSQL_SYSVAR_NAME(name)
277
#define DECLARE_MYSQL_THDVAR_SIMPLE(name, type) struct { \
278
MYSQL_PLUGIN_VAR_HEADER; \
280
type def_val; type min_val; \
281
type max_val; type blk_sz; \
282
DECLARE_THDVAR_FUNC(type); \
283
} MYSQL_SYSVAR_NAME(name)
285
#define DECLARE_MYSQL_THDVAR_TYPELIB(name, type) struct { \
286
MYSQL_PLUGIN_VAR_HEADER; \
289
DECLARE_THDVAR_FUNC(type); \
291
} MYSQL_SYSVAR_NAME(name)
295
the following declarations are for use by plugin implementors
298
#define MYSQL_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
299
DECLARE_MYSQL_SYSVAR_BASIC(name, char) = { \
300
PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \
301
#name, comment, check, update, &varname, def}
303
#define MYSQL_SYSVAR_STR(name, varname, opt, comment, check, update, def) \
304
DECLARE_MYSQL_SYSVAR_BASIC(name, char *) = { \
305
PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \
306
#name, comment, check, update, &varname, def}
308
#define MYSQL_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \
309
DECLARE_MYSQL_SYSVAR_SIMPLE(name, int) = { \
310
PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \
311
#name, comment, check, update, &varname, def, min, max, blk }
313
#define MYSQL_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \
314
DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned int) = { \
315
PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
316
#name, comment, check, update, &varname, def, min, max, blk }
318
#define MYSQL_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \
319
DECLARE_MYSQL_SYSVAR_SIMPLE(name, long) = { \
320
PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \
321
#name, comment, check, update, &varname, def, min, max, blk }
323
#define MYSQL_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \
324
DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long) = { \
325
PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
326
#name, comment, check, update, &varname, def, min, max, blk }
328
#define MYSQL_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
329
DECLARE_MYSQL_SYSVAR_SIMPLE(name, long long) = { \
330
PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \
331
#name, comment, check, update, &varname, def, min, max, blk }
333
#define MYSQL_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
334
DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long long) = { \
335
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
336
#name, comment, check, update, &varname, def, min, max, blk }
338
#define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
339
DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \
340
PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \
341
#name, comment, check, update, &varname, def, typelib }
343
#define MYSQL_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \
344
DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long long) = { \
345
PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \
346
#name, comment, check, update, &varname, def, typelib }
348
#define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \
349
DECLARE_MYSQL_THDVAR_BASIC(name, char) = { \
350
PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
351
#name, comment, check, update, -1, def, NULL}
353
#define MYSQL_THDVAR_STR(name, opt, comment, check, update, def) \
354
DECLARE_MYSQL_THDVAR_BASIC(name, char *) = { \
355
PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
356
#name, comment, check, update, -1, def, NULL}
358
#define MYSQL_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
359
DECLARE_MYSQL_THDVAR_SIMPLE(name, int) = { \
360
PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
361
#name, comment, check, update, -1, def, min, max, blk, NULL }
363
#define MYSQL_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
364
DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned int) = { \
365
PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
366
#name, comment, check, update, -1, def, min, max, blk, NULL }
368
#define MYSQL_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
369
DECLARE_MYSQL_THDVAR_SIMPLE(name, long) = { \
370
PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
371
#name, comment, check, update, -1, def, min, max, blk, NULL }
373
#define MYSQL_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
374
DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long) = { \
375
PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
376
#name, comment, check, update, -1, def, min, max, blk, NULL }
378
#define MYSQL_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
379
DECLARE_MYSQL_THDVAR_SIMPLE(name, long long) = { \
380
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
381
#name, comment, check, update, -1, def, min, max, blk, NULL }
383
#define MYSQL_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
384
DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long long) = { \
385
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
386
#name, comment, check, update, -1, def, min, max, blk, NULL }
388
#define MYSQL_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \
389
DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long) = { \
390
PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
391
#name, comment, check, update, -1, def, NULL, typelib }
393
#define MYSQL_THDVAR_SET(name, opt, comment, check, update, def, typelib) \
394
DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long long) = { \
395
PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
396
#name, comment, check, update, -1, def, NULL, typelib }
398
/* accessor macros */
400
#define SYSVAR(name) \
401
(*(MYSQL_SYSVAR_NAME(name).value))
403
/* when thd == null, result points to global value */
404
#define THDVAR(thd, name) \
405
(*(MYSQL_SYSVAR_NAME(name).resolve(thd, MYSQL_SYSVAR_NAME(name).offset)))
409
Plugin description structure.
412
struct st_mysql_plugin
414
int type; /* the plugin type (a MYSQL_XXX_PLUGIN value) */
415
void *info; /* pointer to type-specific plugin descriptor */
416
const char *name; /* plugin name */
417
const char *author; /* plugin author (for I_S.PLUGINS) */
418
const char *descr; /* general descriptive text (for I_S.PLUGINS) */
419
int license; /* the plugin license (PLUGIN_LICENSE_XXX) */
420
int (*init)(void *); /* the function to invoke when plugin is loaded */
421
int (*deinit)(void *);/* the function to invoke when plugin is unloaded */
422
unsigned int version; /* plugin version (for I_S.PLUGINS) */
423
struct st_mysql_show_var *status_vars;
424
struct st_mysql_sys_var **system_vars;
425
void * __reserved1; /* reserved for dependency checking */
426
unsigned long flags; /* flags for plugin */
429
/*************************************************************************
430
API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN)
432
#include "plugin_ftparser.h"
434
/*************************************************************************
435
API for Storage Engine plugin. (MYSQL_DAEMON_PLUGIN)
438
/* handlertons of different MySQL releases are incompatible */
439
#define MYSQL_DAEMON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
442
Here we define only the descriptor structure, that is referred from
446
struct st_mysql_daemon
448
int interface_version;
452
/*************************************************************************
453
API for I_S plugin. (MYSQL_INFORMATION_SCHEMA_PLUGIN)
456
/* handlertons of different MySQL releases are incompatible */
457
#define MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
460
Here we define only the descriptor structure, that is referred from
464
struct st_mysql_information_schema
466
int interface_version;
470
/*************************************************************************
471
API for Storage Engine plugin. (MYSQL_STORAGE_ENGINE_PLUGIN)
474
/* handlertons of different MySQL releases are incompatible */
475
#define MYSQL_HANDLERTON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
478
The real API is in the sql/handler.h
479
Here we define only the descriptor structure, that is referred from
483
struct st_mysql_storage_engine
485
int interface_version;
492
API for Replication plugin. (MYSQL_REPLICATION_PLUGIN)
494
#define MYSQL_REPLICATION_INTERFACE_VERSION 0x0100
497
Replication plugin descriptor
499
struct Mysql_replication {
500
int interface_version;
503
/*************************************************************************
504
st_mysql_value struct for reading values from mysqld.
505
Used by server variables framework to parse user-provided values.
506
Will be used for arguments when implementing UDFs.
508
Note that val_str() returns a string in temporary memory
509
that will be freed at the end of statement. Copy the string
510
if you need it to persist.
513
#define MYSQL_VALUE_TYPE_STRING 0
514
#define MYSQL_VALUE_TYPE_REAL 1
515
#define MYSQL_VALUE_TYPE_INT 2
517
struct st_mysql_value
519
int (*value_type)(struct st_mysql_value *);
520
const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
521
int (*val_real)(struct st_mysql_value *, double *realbuf);
522
int (*val_int)(struct st_mysql_value *, long long *intbuf);
523
int (*is_unsigned)(struct st_mysql_value *);
527
/*************************************************************************
528
Miscellaneous functions for plugin implementors
535
int thd_in_lock_tables(const MYSQL_THD thd);
536
int thd_tablespace_op(const MYSQL_THD thd);
537
long long thd_test_options(const MYSQL_THD thd, long long test_options);
538
int thd_sql_command(const MYSQL_THD thd);
539
const char *thd_proc_info(MYSQL_THD thd, const char *info);
540
void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
541
void thd_storage_lock_wait(MYSQL_THD thd, long long value);
542
int thd_tx_isolation(const MYSQL_THD thd);
543
char *thd_security_context(MYSQL_THD thd, char *buffer, unsigned int length,
544
unsigned int max_query_len);
545
/* Increments the row counter, see THD::row_count */
546
void thd_inc_row_count(MYSQL_THD thd);
548
void increment_thd_innodb_stats(MYSQL_THD thd,
549
unsigned long long trx_id,
552
long io_reads_wait_timer,
553
long lock_que_wait_timer,
556
unsigned long thd_log_slow_verbosity(const MYSQL_THD thd);
557
int thd_opt_slow_log();
558
#define EXTENDED_SLOWLOG
560
#define EXTENDED_FOR_USERSTAT
563
Create a temporary file.
566
The temporary file is created in a location specified by the mysql
567
server configuration (--tmpdir option). The caller does not need to
568
delete the file, it will be deleted automatically.
570
@param prefix prefix for temporary file name
572
@retval >= 0 a file handle that can be passed to dup or my_close
574
int mysql_tmpfile(const char *prefix);
577
Check the killed state of a connection
580
In MySQL support for the KILL statement is cooperative. The KILL
581
statement only sets a "killed" flag. This function returns the value
582
of that flag. A thread should check it often, especially inside
583
time-consuming loops, and gracefully abort the operation if it is
586
@param thd user thread connection handle
587
@retval 0 the connection is active
588
@retval 1 the connection has been killed
590
int thd_killed(const MYSQL_THD thd);
594
Return the thread id of a user thread
596
@param thd user thread connection handle
599
unsigned long thd_get_thread_id(const MYSQL_THD thd);
602
Get the XID for this connection's transaction
604
@param thd user thread connection handle
605
@param xid location where identifier is stored
607
void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid);
610
Invalidate the query cache for a given table.
612
@param thd user thread connection handle
613
@param key databasename\\0tablename\\0
614
@param key_length length of key in bytes, including the NUL bytes
615
@param using_trx flag: TRUE if using transactions, FALSE otherwise
617
void mysql_query_cache_invalidate4(MYSQL_THD thd,
618
const char *key, unsigned int key_length,
623
Provide a handler data getter to simplify coding
625
void *thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
629
Provide a handler data setter to simplify coding
632
Set ha_data pointer (storage engine per-connection information).
634
To avoid unclean deactivation (uninstall) of storage engine plugin
635
in the middle of transaction, additional storage engine plugin
638
If ha_data is not null and storage engine plugin was not locked
639
by thd_set_ha_data() in this connection before, storage engine
642
If ha_data is null and storage engine plugin was locked by
643
thd_set_ha_data() in this connection before, storage engine
644
plugin lock gets released.
646
If handlerton::close_connection() didn't reset ha_data, server does
647
it immediately after calling handlerton::close_connection().
649
void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton,
650
const void *ha_data);
652
int thd_command(const MYSQL_THD thd);
653
long long thd_start_time(const MYSQL_THD thd);
654
void thd_kill(MYSQL_THD thd);
655
#define EXTENDED_FOR_KILLIDLE