66
34
The allowable types of plugins
68
#define DRIZZLE_DAEMON_PLUGIN 0 /* Daemon / Raw */
69
#define DRIZZLE_STORAGE_ENGINE_PLUGIN 1 /* Storage Engine */
70
#define DRIZZLE_INFORMATION_SCHEMA_PLUGIN 2 /* Information Schema */
71
#define DRIZZLE_UDF_PLUGIN 3 /* User-Defined Function */
72
#define DRIZZLE_UDA_PLUGIN 4 /* User-Defined Aggregate function */
73
#define DRIZZLE_AUDIT_PLUGIN 5 /* Audit */
74
#define DRIZZLE_LOGGER_PLUGIN 6 /* Logging */
75
#define DRIZZLE_AUTH_PLUGIN 7 /* Authorization */
36
enum drizzle_plugin_type {
37
DRIZZLE_DAEMON_PLUGIN, /* Daemon / Raw */
38
DRIZZLE_STORAGE_ENGINE_PLUGIN, /* Storage Engine */
39
DRIZZLE_INFORMATION_SCHEMA_PLUGIN, /* Information Schema */
40
DRIZZLE_UDF_PLUGIN, /* User-Defined Function */
41
DRIZZLE_UDA_PLUGIN, /* User-Defined Aggregate Function */
42
DRIZZLE_AUDIT_PLUGIN, /* Audit */
43
DRIZZLE_LOGGER_PLUGIN, /* Query Logging */
44
DRIZZLE_ERRMSG_PLUGIN, /* Error Messages */
45
DRIZZLE_AUTH_PLUGIN, /* Authorization */
46
DRIZZLE_CONFIGVAR_PLUGIN, /* Configuration Variables */
47
DRIZZLE_QCACHE_PLUGIN, /* Query Cache */
48
DRIZZLE_PARSER_PLUGIN, /* Language Parser */
49
DRIZZLE_SCHEDULING_PLUGIN, /* Thread and Session Scheduling */
50
DRIZZLE_REPLICATOR_PLUGIN, /* Database Replication */
51
DRIZZLE_PLUGIN_MAX=DRIZZLE_REPLICATOR_PLUGIN
77
#define DRIZZLE_MAX_PLUGIN_TYPE_NUM 8 /* The number of plugin types */
54
/* The number of plugin types */
55
const uint32_t DRIZZLE_MAX_PLUGIN_TYPE_NUM=DRIZZLE_PLUGIN_MAX+1;
79
57
/* We use the following strings to define licenses for plugins */
80
#define PLUGIN_LICENSE_PROPRIETARY 0
81
#define PLUGIN_LICENSE_GPL 1
82
#define PLUGIN_LICENSE_BSD 2
58
enum plugin_license_type {
59
PLUGIN_LICENSE_PROPRIETARY,
63
PLUGIN_LICENSE_MAX=PLUGIN_LICENSE_LGPL
84
#define PLUGIN_LICENSE_PROPRIETARY_STRING "PROPRIETARY"
85
#define PLUGIN_LICENSE_GPL_STRING "GPL"
86
#define PLUGIN_LICENSE_BSD_STRING "BSD"
66
const char * const PLUGIN_LICENSE_PROPRIETARY_STRING="PROPRIETARY";
67
const char * const PLUGIN_LICENSE_GPL_STRING="GPL";
68
const char * const PLUGIN_LICENSE_BSD_STRING="BSD";
69
const char * const PLUGIN_LICENSE_LGPL_STRING="LGPL";
89
Macros for beginning and ending plugin declarations. Between
90
mysql_declare_plugin and mysql_declare_plugin_end there should
72
Macros for beginning and ending plugin declarations. Between
73
drizzle_declare_plugin and drizzle_declare_plugin_end there should
91
74
be a st_mysql_plugin struct for each plugin to be declared.
323
306
PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \
324
307
#name, comment, check, update, &varname, def, typelib }
326
#define DRIZZLE_THDVAR_BOOL(name, opt, comment, check, update, def) \
327
DECLARE_DRIZZLE_THDVAR_BASIC(name, char) = { \
328
PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
329
#name, comment, check, update, -1, def, NULL}
331
#define DRIZZLE_THDVAR_STR(name, opt, comment, check, update, def) \
332
DECLARE_DRIZZLE_THDVAR_BASIC(name, char *) = { \
333
PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
334
#name, comment, check, update, -1, def, NULL}
336
#define DRIZZLE_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
337
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, int) = { \
338
PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
339
#name, comment, check, update, -1, def, min, max, blk, NULL }
341
#define DRIZZLE_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
342
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, unsigned int) = { \
343
PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
344
#name, comment, check, update, -1, def, min, max, blk, NULL }
346
#define DRIZZLE_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
347
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, long) = { \
348
PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
349
#name, comment, check, update, -1, def, min, max, blk, NULL }
351
#define DRIZZLE_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
352
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, unsigned long) = { \
353
PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
354
#name, comment, check, update, -1, def, min, max, blk, NULL }
356
#define DRIZZLE_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
357
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, int64_t) = { \
358
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
359
#name, comment, check, update, -1, def, min, max, blk, NULL }
361
#define DRIZZLE_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
362
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, uint64_t) = { \
363
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
364
#name, comment, check, update, -1, def, min, max, blk, NULL }
366
#define DRIZZLE_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \
367
DECLARE_DRIZZLE_THDVAR_TYPELIB(name, unsigned long) = { \
368
PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
309
#define DRIZZLE_SessionVAR_BOOL(name, opt, comment, check, update, def) \
310
DECLARE_DRIZZLE_SessionVAR_BASIC(name, char) = { \
311
PLUGIN_VAR_BOOL | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
312
#name, comment, check, update, -1, def, NULL}
314
#define DRIZZLE_SessionVAR_STR(name, opt, comment, check, update, def) \
315
DECLARE_DRIZZLE_SessionVAR_BASIC(name, char *) = { \
316
PLUGIN_VAR_STR | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
317
#name, comment, check, update, -1, def, NULL}
319
#define DRIZZLE_SessionVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
320
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, int) = { \
321
PLUGIN_VAR_INT | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
322
#name, comment, check, update, -1, def, min, max, blk, NULL }
324
#define DRIZZLE_SessionVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
325
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, unsigned int) = { \
326
PLUGIN_VAR_INT | PLUGIN_VAR_SessionLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
327
#name, comment, check, update, -1, def, min, max, blk, NULL }
329
#define DRIZZLE_SessionVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
330
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, long) = { \
331
PLUGIN_VAR_LONG | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
332
#name, comment, check, update, -1, def, min, max, blk, NULL }
334
#define DRIZZLE_SessionVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
335
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, unsigned long) = { \
336
PLUGIN_VAR_LONG | PLUGIN_VAR_SessionLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
337
#name, comment, check, update, -1, def, min, max, blk, NULL }
339
#define DRIZZLE_SessionVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
340
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, int64_t) = { \
341
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
342
#name, comment, check, update, -1, def, min, max, blk, NULL }
344
#define DRIZZLE_SessionVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
345
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, uint64_t) = { \
346
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_SessionLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
347
#name, comment, check, update, -1, def, min, max, blk, NULL }
349
#define DRIZZLE_SessionVAR_ENUM(name, opt, comment, check, update, def, typelib) \
350
DECLARE_DRIZZLE_SessionVAR_TYPELIB(name, unsigned long) = { \
351
PLUGIN_VAR_ENUM | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
369
352
#name, comment, check, update, -1, def, NULL, typelib }
371
#define DRIZZLE_THDVAR_SET(name, opt, comment, check, update, def, typelib) \
372
DECLARE_DRIZZLE_THDVAR_TYPELIB(name, uint64_t) = { \
373
PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
354
#define DRIZZLE_SessionVAR_SET(name, opt, comment, check, update, def, typelib) \
355
DECLARE_DRIZZLE_SessionVAR_TYPELIB(name, uint64_t) = { \
356
PLUGIN_VAR_SET | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
374
357
#name, comment, check, update, -1, def, NULL, typelib }
376
359
/* accessor macros */
499
510
@see alloc_root()
501
void *thd_alloc(DRIZZLE_THD thd, unsigned int size);
505
void *thd_calloc(DRIZZLE_THD thd, unsigned int size);
509
char *thd_strdup(DRIZZLE_THD thd, const char *str);
513
char *thd_strmake(DRIZZLE_THD thd, const char *str, unsigned int size);
517
void *thd_memdup(DRIZZLE_THD thd, const void* str, unsigned int size);
520
Create a LEX_STRING in this connection's local memory pool
522
@param thd user thread connection handle
523
@param lex_str pointer to LEX_STRING object to be initialized
524
@param str initializer to be copied into lex_str
525
@param size length of str, in bytes
526
@param allocate_lex_string flag: if TRUE, allocate new LEX_STRING object,
527
instead of using lex_str value
528
@return NULL on failure, or pointer to the LEX_STRING object
532
DRIZZLE_LEX_STRING *thd_make_lex_string(DRIZZLE_THD thd, DRIZZLE_LEX_STRING *lex_str,
533
const char *str, unsigned int size,
534
int allocate_lex_string);
512
void *session_alloc(Session *session, unsigned int size);
516
void *session_calloc(Session *session, unsigned int size);
520
char *session_strdup(Session *session, const char *str);
524
char *session_strmake(Session *session, const char *str, unsigned int size);
528
void *session_memdup(Session *session, const void* str, unsigned int size);
537
531
Get the XID for this connection's transaction
539
@param thd user thread connection handle
533
@param session user thread connection handle
540
534
@param xid location where identifier is stored
542
void thd_get_xid(const DRIZZLE_THD thd, DRIZZLE_XID *xid);
536
void session_get_xid(const Session *session, DRIZZLE_XID *xid);
545
539
Invalidate the query cache for a given table.
547
@param thd user thread connection handle
541
@param session user thread connection handle
548
542
@param key databasename\\0tablename\\0
549
543
@param key_length length of key in bytes, including the NUL bytes
550
544
@param using_trx flag: TRUE if using transactions, FALSE otherwise
552
void mysql_query_cache_invalidate4(DRIZZLE_THD thd,
546
void mysql_query_cache_invalidate4(Session *session,
553
547
const char *key, unsigned int key_length,