1
/* Copyright (C) 2005 MySQL AB
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#ifndef DRIZZLED_PLUGIN_H
21
#define DRIZZLED_PLUGIN_H
19
23
#include <drizzled/global.h>
24
#define DRIZZLE_THD THD*
26
#define DRIZZLE_THD void*
31
/* This definition must match the one given in m_string.h */
32
struct st_mysql_lex_string
37
#endif /* _m_string_h */
38
typedef struct st_mysql_lex_string DRIZZLE_LEX_STRING;
40
28
#define DRIZZLE_XIDDATASIZE 128
65
53
#define DRIZZLE_STORAGE_ENGINE_PLUGIN 1 /* Storage Engine */
66
54
#define DRIZZLE_INFORMATION_SCHEMA_PLUGIN 2 /* Information Schema */
67
55
#define DRIZZLE_UDF_PLUGIN 3 /* User-Defined Function */
68
#define DRIZZLE_UDA_PLUGIN 4 /* User-Defined Aggregate function */
56
#define DRIZZLE_UDA_PLUGIN 4 /* User-Defined Aggregate Function */
69
57
#define DRIZZLE_AUDIT_PLUGIN 5 /* Audit */
70
#define DRIZZLE_LOGGER_PLUGIN 6 /* Logging */
71
#define DRIZZLE_AUTH_PLUGIN 7 /* Authorization */
58
#define DRIZZLE_LOGGER_PLUGIN 6 /* Query Logging */
59
#define DRIZZLE_ERRMSG_PLUGIN 7 /* Error Messages */
60
#define DRIZZLE_AUTH_PLUGIN 8 /* Authorization */
61
#define DRIZZLE_CONFIGVAR_PLUGIN 9 /* Configuration */
62
#define DRIZZLE_QCACHE_PLUGIN 10 /* Query Cache */
73
#define DRIZZLE_MAX_PLUGIN_TYPE_NUM 8 /* The number of plugin types */
64
#define DRIZZLE_MAX_PLUGIN_TYPE_NUM 11 /* The number of plugin types */
75
66
/* We use the following strings to define licenses for plugins */
76
67
#define PLUGIN_LICENSE_PROPRIETARY 0
122
113
#define SHOW_VAR_FUNC_BUFF_SIZE 1024
123
typedef int (*mysql_show_var_func)(DRIZZLE_THD, struct st_mysql_show_var*, char *);
114
typedef int (*mysql_show_var_func)(THD *, struct st_mysql_show_var *, char *);
125
116
struct st_show_var_func_container {
126
117
mysql_show_var_func func;
169
160
automatically at the end of the statement.
172
typedef int (*mysql_var_check_func)(DRIZZLE_THD thd,
163
typedef int (*mysql_var_check_func)(THD *thd,
173
164
struct st_mysql_sys_var *var,
174
165
void *save, struct st_mysql_value *value);
187
178
and persist it in the provided pointer to the dynamic variable.
188
179
For example, strings may require memory to be allocated.
190
typedef void (*mysql_var_update_func)(DRIZZLE_THD thd,
181
typedef void (*mysql_var_update_func)(THD *thd,
191
182
struct st_mysql_sys_var *var,
192
183
void *var_ptr, const void *save);
239
230
} DRIZZLE_SYSVAR_NAME(name)
241
232
#define DECLARE_THDVAR_FUNC(type) \
242
type *(*resolve)(DRIZZLE_THD thd, int offset)
233
type *(*resolve)(THD *thd, int offset)
244
235
#define DECLARE_DRIZZLE_THDVAR_BASIC(name, type) struct { \
245
236
DRIZZLE_PLUGIN_VAR_HEADER; \
435
int thd_in_lock_tables(const DRIZZLE_THD thd);
436
int thd_tablespace_op(const DRIZZLE_THD thd);
437
int64_t thd_test_options(const DRIZZLE_THD thd, int64_t test_options);
438
int thd_sql_command(const DRIZZLE_THD thd);
439
const char *thd_proc_info(DRIZZLE_THD thd, const char *info);
440
void **thd_ha_data(const DRIZZLE_THD thd, const struct handlerton *hton);
441
int thd_tx_isolation(const DRIZZLE_THD thd);
426
int thd_in_lock_tables(const THD *thd);
427
int thd_tablespace_op(const THD *thd);
428
int64_t thd_test_options(const THD *thd, int64_t test_options);
429
int thd_sql_command(const THD *thd);
430
void **thd_ha_data(const THD *thd, const struct handlerton *hton);
431
int thd_tx_isolation(const THD *thd);
442
432
/* Increments the row counter, see THD::row_count */
443
void thd_inc_row_count(DRIZZLE_THD thd);
433
void thd_inc_row_count(THD *thd);
446
436
Create a temporary file.
495
485
@see alloc_root()
497
void *thd_alloc(DRIZZLE_THD thd, unsigned int size);
501
void *thd_calloc(DRIZZLE_THD thd, unsigned int size);
505
char *thd_strdup(DRIZZLE_THD thd, const char *str);
509
char *thd_strmake(DRIZZLE_THD thd, const char *str, unsigned int size);
513
void *thd_memdup(DRIZZLE_THD thd, const void* str, unsigned int size);
516
Create a LEX_STRING in this connection's local memory pool
518
@param thd user thread connection handle
519
@param lex_str pointer to LEX_STRING object to be initialized
520
@param str initializer to be copied into lex_str
521
@param size length of str, in bytes
522
@param allocate_lex_string flag: if TRUE, allocate new LEX_STRING object,
523
instead of using lex_str value
524
@return NULL on failure, or pointer to the LEX_STRING object
528
DRIZZLE_LEX_STRING *thd_make_lex_string(DRIZZLE_THD thd, DRIZZLE_LEX_STRING *lex_str,
529
const char *str, unsigned int size,
530
int allocate_lex_string);
487
void *thd_alloc(THD *thd, unsigned int size);
491
void *thd_calloc(THD *thd, unsigned int size);
495
char *thd_strdup(THD *thd, const char *str);
499
char *thd_strmake(THD *thd, const char *str, unsigned int size);
503
void *thd_memdup(THD *thd, const void* str, unsigned int size);
533
506
Get the XID for this connection's transaction
535
508
@param thd user thread connection handle
536
509
@param xid location where identifier is stored
538
void thd_get_xid(const DRIZZLE_THD thd, DRIZZLE_XID *xid);
511
void thd_get_xid(const THD *thd, DRIZZLE_XID *xid);
541
514
Invalidate the query cache for a given table.
545
518
@param key_length length of key in bytes, including the NUL bytes
546
519
@param using_trx flag: TRUE if using transactions, FALSE otherwise
548
void mysql_query_cache_invalidate4(DRIZZLE_THD thd,
521
void mysql_query_cache_invalidate4(THD *thd,
549
522
const char *key, unsigned int key_length,
572
thd_set_ha_data(const DRIZZLE_THD thd, const struct handlerton *hton,
545
thd_set_ha_data(const THD *thd, const struct handlerton *hton,
573
546
const void *ha_data)
575
548
*thd_ha_data(thd, hton)= (void*) ha_data;
552
#endif /* _my_plugin_h */