~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to include/mysql/plugin.h

Removed DBUG symbols and fixed TRUE/FALSE

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems
5
 
 *
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.
9
 
 *
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.
14
 
 *
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
18
 
 */
 
1
/* Copyright (C) 2005 MySQL AB
 
2
 
 
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.
 
6
 
 
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.
 
11
 
 
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 */
19
15
 
20
16
#ifndef _my_plugin_h
21
17
#define _my_plugin_h
22
18
 
23
 
#include <drizzled/global.h>
24
 
 
25
19
#ifdef __cplusplus
26
20
class THD;
27
21
class Item;
28
 
#define DRIZZLE_THD THD*
 
22
#define MYSQL_THD THD*
29
23
#else
30
 
#define DRIZZLE_THD void*
 
24
#define MYSQL_THD void*
31
25
#endif
32
26
 
33
 
#define DRIZZLE_XIDDATASIZE 128
 
27
#include <stdint.h>
 
28
 
 
29
#ifndef _m_string_h
 
30
/* This definition must match the one given in m_string.h */
 
31
struct st_mysql_lex_string
 
32
{
 
33
  char *str;
 
34
  unsigned int length;
 
35
};
 
36
#endif /* _m_string_h */
 
37
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
 
38
 
 
39
#define MYSQL_XIDDATASIZE 128
34
40
/**
35
41
  struct st_mysql_xid is binary compatible with the XID structure as
36
42
  in the X/Open CAE Specification, Distributed Transaction Processing:
43
49
  long formatID;
44
50
  long gtrid_length;
45
51
  long bqual_length;
46
 
  char data[DRIZZLE_XIDDATASIZE];  /* Not \0-terminated */
 
52
  char data[MYSQL_XIDDATASIZE];  /* Not \0-terminated */
47
53
};
48
 
typedef struct st_mysql_xid DRIZZLE_XID;
 
54
typedef struct st_mysql_xid MYSQL_XID;
49
55
 
50
56
/*************************************************************************
51
57
  Plugin API. Common for all plugin types.
52
58
*/
53
59
 
 
60
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0100
 
61
 
54
62
/*
55
63
  The allowable types of plugins
56
64
*/
57
 
#define DRIZZLE_DAEMON_PLUGIN          0  /* Daemon / Raw */
58
 
#define DRIZZLE_STORAGE_ENGINE_PLUGIN  1  /* Storage Engine */
59
 
#define DRIZZLE_INFORMATION_SCHEMA_PLUGIN  2  /* Information Schema */
60
 
#define DRIZZLE_UDF_PLUGIN             3  /* User-Defined Function */
61
 
#define DRIZZLE_UDA_PLUGIN             4  /* User-Defined Aggregate function */
62
 
#define DRIZZLE_AUDIT_PLUGIN           5  /* Audit */
63
 
#define DRIZZLE_LOGGER_PLUGIN          6  /* Logging */
64
 
#define DRIZZLE_AUTH_PLUGIN            7  /* Authorization */
65
 
 
66
 
#define DRIZZLE_MAX_PLUGIN_TYPE_NUM    8  /* The number of plugin types */
 
65
#define MYSQL_UDF_PLUGIN             0  /* User-defined function        */
 
66
#define MYSQL_STORAGE_ENGINE_PLUGIN  1  /* Storage Engine               */
 
67
#define MYSQL_FTPARSER_PLUGIN        2  /* Full-text parser plugin      */
 
68
#define MYSQL_DAEMON_PLUGIN          3  /* The daemon/raw plugin type */
 
69
#define MYSQL_INFORMATION_SCHEMA_PLUGIN  4  /* The I_S plugin type */
 
70
#define MYSQL_AUDIT_PLUGIN           5  /* The Audit plugin type        */
 
71
#define MYSQL_MAX_PLUGIN_TYPE_NUM    6  /* The number of plugin types   */
67
72
 
68
73
/* We use the following strings to define licenses for plugins */
69
74
#define PLUGIN_LICENSE_PROPRIETARY 0
81
86
*/
82
87
 
83
88
 
84
 
#ifndef DRIZZLE_DYNAMIC_PLUGIN
85
 
#define __DRIZZLE_DECLARE_PLUGIN(NAME, DECLS) \
 
89
#ifndef MYSQL_DYNAMIC_PLUGIN
 
90
#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS)                   \
 
91
int VERSION= MYSQL_PLUGIN_INTERFACE_VERSION;                                  \
 
92
int PSIZE= sizeof(struct st_mysql_plugin);                                    \
86
93
struct st_mysql_plugin DECLS[]= {
87
94
#else
88
 
#define __DRIZZLE_DECLARE_PLUGIN(NAME, DECLS) \
 
95
#define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS)                   \
 
96
int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION;         \
 
97
int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin);          \
89
98
struct st_mysql_plugin _mysql_plugin_declarations_[]= {
90
99
#endif
91
100
 
92
101
#define mysql_declare_plugin(NAME) \
93
 
__DRIZZLE_DECLARE_PLUGIN(NAME, \
 
102
__MYSQL_DECLARE_PLUGIN(NAME, \
 
103
                 builtin_ ## NAME ## _plugin_interface_version, \
 
104
                 builtin_ ## NAME ## _sizeof_struct_st_plugin, \
94
105
                 builtin_ ## NAME ## _plugin)
95
106
 
96
 
#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0}}
 
107
#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0}}
97
108
 
98
109
/*
99
110
  declarations for SHOW STATUS support in plugins
113
124
 
114
125
 
115
126
#define SHOW_VAR_FUNC_BUFF_SIZE 1024
116
 
typedef int (*mysql_show_var_func)(DRIZZLE_THD, struct st_mysql_show_var*, char *);
 
127
typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *);
117
128
 
118
 
struct st_show_var_func_container {
119
 
  mysql_show_var_func func;
120
 
};
121
129
/*
122
130
  declarations for server variables and command line options
123
131
*/
162
170
  automatically at the end of the statement.
163
171
*/
164
172
 
165
 
typedef int (*mysql_var_check_func)(DRIZZLE_THD thd,
 
173
typedef int (*mysql_var_check_func)(MYSQL_THD thd,
166
174
                                    struct st_mysql_sys_var *var,
167
175
                                    void *save, struct st_mysql_value *value);
168
176
 
180
188
   and persist it in the provided pointer to the dynamic variable.
181
189
   For example, strings may require memory to be allocated.
182
190
*/
183
 
typedef void (*mysql_var_update_func)(DRIZZLE_THD thd,
 
191
typedef void (*mysql_var_update_func)(MYSQL_THD thd,
184
192
                                      struct st_mysql_sys_var *var,
185
193
                                      void *var_ptr, const void *save);
186
194
 
193
201
         PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \
194
202
         PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC)
195
203
 
196
 
#define DRIZZLE_PLUGIN_VAR_HEADER \
 
204
#define MYSQL_PLUGIN_VAR_HEADER \
197
205
  int flags;                    \
198
206
  const char *name;             \
199
207
  const char *comment;          \
200
208
  mysql_var_check_func check;   \
201
209
  mysql_var_update_func update
202
210
 
203
 
#define DRIZZLE_SYSVAR_NAME(name) mysql_sysvar_ ## name
204
 
#define DRIZZLE_SYSVAR(name) \
205
 
  ((struct st_mysql_sys_var *)&(DRIZZLE_SYSVAR_NAME(name)))
 
211
#define MYSQL_SYSVAR_NAME(name) mysql_sysvar_ ## name
 
212
#define MYSQL_SYSVAR(name) \
 
213
  ((struct st_mysql_sys_var *)&(MYSQL_SYSVAR_NAME(name)))
206
214
 
207
215
/*
208
216
  for global variables, the value pointer is the first
212
220
*/
213
221
   
214
222
 
215
 
#define DECLARE_DRIZZLE_SYSVAR_BASIC(name, type) struct { \
216
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
223
#define DECLARE_MYSQL_SYSVAR_BASIC(name, type) struct { \
 
224
  MYSQL_PLUGIN_VAR_HEADER;      \
217
225
  type *value;                  \
218
226
  const type def_val;           \
219
 
} DRIZZLE_SYSVAR_NAME(name)
 
227
} MYSQL_SYSVAR_NAME(name)
220
228
 
221
 
#define DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, type) struct { \
222
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
229
#define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \
 
230
  MYSQL_PLUGIN_VAR_HEADER;      \
223
231
  type *value; type def_val;    \
224
232
  type min_val; type max_val;   \
225
233
  type blk_sz;                  \
226
 
} DRIZZLE_SYSVAR_NAME(name)
 
234
} MYSQL_SYSVAR_NAME(name)
227
235
 
228
 
#define DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, type) struct { \
229
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
236
#define DECLARE_MYSQL_SYSVAR_TYPELIB(name, type) struct { \
 
237
  MYSQL_PLUGIN_VAR_HEADER;      \
230
238
  type *value; type def_val;    \
231
239
  TYPELIB *typelib;             \
232
 
} DRIZZLE_SYSVAR_NAME(name)
 
240
} MYSQL_SYSVAR_NAME(name)
233
241
 
234
242
#define DECLARE_THDVAR_FUNC(type) \
235
 
  type *(*resolve)(DRIZZLE_THD thd, int offset)
 
243
  type *(*resolve)(MYSQL_THD thd, int offset)
236
244
 
237
 
#define DECLARE_DRIZZLE_THDVAR_BASIC(name, type) struct { \
238
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
245
#define DECLARE_MYSQL_THDVAR_BASIC(name, type) struct { \
 
246
  MYSQL_PLUGIN_VAR_HEADER;      \
239
247
  int offset;                   \
240
248
  const type def_val;           \
241
249
  DECLARE_THDVAR_FUNC(type);    \
242
 
} DRIZZLE_SYSVAR_NAME(name)
 
250
} MYSQL_SYSVAR_NAME(name)
243
251
 
244
 
#define DECLARE_DRIZZLE_THDVAR_SIMPLE(name, type) struct { \
245
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
252
#define DECLARE_MYSQL_THDVAR_SIMPLE(name, type) struct { \
 
253
  MYSQL_PLUGIN_VAR_HEADER;      \
246
254
  int offset;                   \
247
255
  type def_val; type min_val;   \
248
256
  type max_val; type blk_sz;    \
249
257
  DECLARE_THDVAR_FUNC(type);    \
250
 
} DRIZZLE_SYSVAR_NAME(name)
 
258
} MYSQL_SYSVAR_NAME(name)
251
259
 
252
 
#define DECLARE_DRIZZLE_THDVAR_TYPELIB(name, type) struct { \
253
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
260
#define DECLARE_MYSQL_THDVAR_TYPELIB(name, type) struct { \
 
261
  MYSQL_PLUGIN_VAR_HEADER;      \
254
262
  int offset;                   \
255
263
  type def_val;                 \
256
264
  DECLARE_THDVAR_FUNC(type);    \
257
265
  TYPELIB *typelib;             \
258
 
} DRIZZLE_SYSVAR_NAME(name)
 
266
} MYSQL_SYSVAR_NAME(name)
259
267
 
260
268
 
261
269
/*
262
270
  the following declarations are for use by plugin implementors
263
271
*/
264
272
 
265
 
#define DRIZZLE_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
266
 
DECLARE_DRIZZLE_SYSVAR_BASIC(name, bool) = { \
 
273
#define MYSQL_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
 
274
DECLARE_MYSQL_SYSVAR_BASIC(name, char) = { \
267
275
  PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \
268
276
  #name, comment, check, update, &varname, def}
269
277
 
270
 
#define DRIZZLE_SYSVAR_STR(name, varname, opt, comment, check, update, def) \
271
 
DECLARE_DRIZZLE_SYSVAR_BASIC(name, char *) = { \
 
278
#define MYSQL_SYSVAR_STR(name, varname, opt, comment, check, update, def) \
 
279
DECLARE_MYSQL_SYSVAR_BASIC(name, char *) = { \
272
280
  PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \
273
281
  #name, comment, check, update, &varname, def}
274
282
 
275
 
#define DRIZZLE_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \
276
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, int) = { \
 
283
#define MYSQL_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \
 
284
DECLARE_MYSQL_SYSVAR_SIMPLE(name, int) = { \
277
285
  PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \
278
286
  #name, comment, check, update, &varname, def, min, max, blk }
279
287
 
280
 
#define DRIZZLE_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \
281
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, unsigned int) = { \
 
288
#define MYSQL_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \
 
289
DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned int) = { \
282
290
  PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
283
291
  #name, comment, check, update, &varname, def, min, max, blk }
284
292
 
285
 
#define DRIZZLE_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \
286
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, long) = { \
 
293
#define MYSQL_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \
 
294
DECLARE_MYSQL_SYSVAR_SIMPLE(name, long) = { \
287
295
  PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \
288
296
  #name, comment, check, update, &varname, def, min, max, blk }
289
297
 
290
 
#define DRIZZLE_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \
291
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, unsigned long) = { \
 
298
#define MYSQL_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \
 
299
DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long) = { \
292
300
  PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
293
301
  #name, comment, check, update, &varname, def, min, max, blk }
294
302
 
295
 
#define DRIZZLE_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
296
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, int64_t) = { \
 
303
#define MYSQL_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
 
304
DECLARE_MYSQL_SYSVAR_SIMPLE(name, int64_t) = { \
297
305
  PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \
298
306
  #name, comment, check, update, &varname, def, min, max, blk }
299
307
 
300
 
#define DRIZZLE_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
301
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, uint64_t) = { \
 
308
#define MYSQL_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
 
309
DECLARE_MYSQL_SYSVAR_SIMPLE(name, uint64_t) = { \
302
310
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
303
311
  #name, comment, check, update, &varname, def, min, max, blk }
304
312
 
305
 
#define DRIZZLE_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
306
 
DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, unsigned long) = { \
 
313
#define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
 
314
DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \
307
315
  PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \
308
316
  #name, comment, check, update, &varname, def, typelib }
309
317
 
310
 
#define DRIZZLE_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \
311
 
DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, uint64_t) = { \
 
318
#define MYSQL_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \
 
319
DECLARE_MYSQL_SYSVAR_TYPELIB(name, uint64_t) = { \
312
320
  PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \
313
321
  #name, comment, check, update, &varname, def, typelib }
314
322
 
315
 
#define DRIZZLE_THDVAR_BOOL(name, opt, comment, check, update, def) \
316
 
DECLARE_DRIZZLE_THDVAR_BASIC(name, char) = { \
 
323
#define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \
 
324
DECLARE_MYSQL_THDVAR_BASIC(name, char) = { \
317
325
  PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
318
326
  #name, comment, check, update, -1, def, NULL}
319
327
 
320
 
#define DRIZZLE_THDVAR_STR(name, opt, comment, check, update, def) \
321
 
DECLARE_DRIZZLE_THDVAR_BASIC(name, char *) = { \
 
328
#define MYSQL_THDVAR_STR(name, opt, comment, check, update, def) \
 
329
DECLARE_MYSQL_THDVAR_BASIC(name, char *) = { \
322
330
  PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
323
331
  #name, comment, check, update, -1, def, NULL}
324
332
 
325
 
#define DRIZZLE_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
326
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, int) = { \
 
333
#define MYSQL_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
 
334
DECLARE_MYSQL_THDVAR_SIMPLE(name, int) = { \
327
335
  PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
328
336
  #name, comment, check, update, -1, def, min, max, blk, NULL }
329
337
 
330
 
#define DRIZZLE_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
331
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, unsigned int) = { \
 
338
#define MYSQL_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
 
339
DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned int) = { \
332
340
  PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
333
341
  #name, comment, check, update, -1, def, min, max, blk, NULL }
334
342
 
335
 
#define DRIZZLE_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
336
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, long) = { \
 
343
#define MYSQL_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
 
344
DECLARE_MYSQL_THDVAR_SIMPLE(name, long) = { \
337
345
  PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
338
346
  #name, comment, check, update, -1, def, min, max, blk, NULL }
339
347
 
340
 
#define DRIZZLE_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
341
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, unsigned long) = { \
 
348
#define MYSQL_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
 
349
DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long) = { \
342
350
  PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
343
351
  #name, comment, check, update, -1, def, min, max, blk, NULL }
344
352
 
345
 
#define DRIZZLE_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
346
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, int64_t) = { \
 
353
#define MYSQL_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
 
354
DECLARE_MYSQL_THDVAR_SIMPLE(name, int64_t) = { \
347
355
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
348
356
  #name, comment, check, update, -1, def, min, max, blk, NULL }
349
357
 
350
 
#define DRIZZLE_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
351
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, uint64_t) = { \
 
358
#define MYSQL_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
 
359
DECLARE_MYSQL_THDVAR_SIMPLE(name, uint64_t) = { \
352
360
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
353
361
  #name, comment, check, update, -1, def, min, max, blk, NULL }
354
362
 
355
 
#define DRIZZLE_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \
356
 
DECLARE_DRIZZLE_THDVAR_TYPELIB(name, unsigned long) = { \
 
363
#define MYSQL_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \
 
364
DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long) = { \
357
365
  PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
358
366
  #name, comment, check, update, -1, def, NULL, typelib }
359
367
 
360
 
#define DRIZZLE_THDVAR_SET(name, opt, comment, check, update, def, typelib) \
361
 
DECLARE_DRIZZLE_THDVAR_TYPELIB(name, uint64_t) = { \
 
368
#define MYSQL_THDVAR_SET(name, opt, comment, check, update, def, typelib) \
 
369
DECLARE_MYSQL_THDVAR_TYPELIB(name, uint64_t) = { \
362
370
  PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
363
371
  #name, comment, check, update, -1, def, NULL, typelib }
364
372
 
365
373
/* accessor macros */
366
374
 
367
375
#define SYSVAR(name) \
368
 
  (*(DRIZZLE_SYSVAR_NAME(name).value))
 
376
  (*(MYSQL_SYSVAR_NAME(name).value))
369
377
 
370
378
/* when thd == null, result points to global value */
371
379
#define THDVAR(thd, name) \
372
 
  (*(DRIZZLE_SYSVAR_NAME(name).resolve(thd, DRIZZLE_SYSVAR_NAME(name).offset)))
 
380
  (*(MYSQL_SYSVAR_NAME(name).resolve(thd, MYSQL_SYSVAR_NAME(name).offset)))
373
381
 
374
382
 
375
383
/*
378
386
 
379
387
struct st_mysql_plugin
380
388
{
381
 
  int type;             /* the plugin type (a DRIZZLE_XXX_PLUGIN value)   */
382
 
  const char *name;     /* plugin name (for SHOW PLUGINS)               */
383
 
  const char *version;  /* plugin version (for SHOW PLUGINS)            */
 
389
  int type;             /* the plugin type (a MYSQL_XXX_PLUGIN value)   */
 
390
  void *info;           /* pointer to type-specific plugin descriptor   */
 
391
  const char *name;     /* plugin name                                  */
384
392
  const char *author;   /* plugin author (for SHOW PLUGINS)             */
385
393
  const char *descr;    /* general descriptive text (for SHOW PLUGINS ) */
386
394
  int license;          /* the plugin license (PLUGIN_LICENSE_XXX)      */
387
395
  int (*init)(void *);  /* the function to invoke when plugin is loaded */
388
396
  int (*deinit)(void *);/* the function to invoke when plugin is unloaded */
 
397
  unsigned int version; /* plugin version (for SHOW PLUGINS)            */
389
398
  struct st_mysql_show_var *status_vars;
390
399
  struct st_mysql_sys_var **system_vars;
391
400
  void * __reserved1;   /* reserved for dependency checking             */
392
401
};
393
402
 
 
403
/*************************************************************************
 
404
  API for Full-text parser plugin. (MYSQL_FTPARSER_PLUGIN)
 
405
*/
 
406
#include "plugin_ftparser.h"
 
407
 
 
408
/*************************************************************************
 
409
  API for Storage Engine plugin. (MYSQL_DAEMON_PLUGIN)
 
410
*/
 
411
 
 
412
/* handlertons of different MySQL releases are incompatible */
 
413
#define MYSQL_DAEMON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
 
414
 
 
415
/*
 
416
  Here we define only the descriptor structure, that is referred from
 
417
  st_mysql_plugin.
 
418
*/
 
419
 
 
420
struct st_mysql_daemon
 
421
{
 
422
  int interface_version;
 
423
};
 
424
 
 
425
 
 
426
/*************************************************************************
 
427
  API for I_S plugin. (MYSQL_INFORMATION_SCHEMA_PLUGIN)
 
428
*/
 
429
 
 
430
/* handlertons of different MySQL releases are incompatible */
 
431
#define MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
 
432
 
 
433
/*
 
434
  Here we define only the descriptor structure, that is referred from
 
435
  st_mysql_plugin.
 
436
*/
 
437
 
 
438
struct st_mysql_information_schema
 
439
{
 
440
  int interface_version;
 
441
};
 
442
 
 
443
 
 
444
/*************************************************************************
 
445
  API for Storage Engine plugin. (MYSQL_STORAGE_ENGINE_PLUGIN)
 
446
*/
 
447
 
 
448
/* handlertons of different MySQL releases are incompatible */
 
449
#define MYSQL_HANDLERTON_INTERFACE_VERSION (MYSQL_VERSION_ID << 8)
 
450
 
 
451
/*
 
452
  The real API is in the sql/handler.h
 
453
  Here we define only the descriptor structure, that is referred from
 
454
  st_mysql_plugin.
 
455
*/
 
456
 
 
457
struct st_mysql_storage_engine
 
458
{
 
459
  int interface_version;
 
460
};
 
461
 
394
462
struct handlerton;
395
463
 
396
464
 
404
472
  if you need it to persist.
405
473
*/
406
474
 
407
 
#define DRIZZLE_VALUE_TYPE_STRING 0
408
 
#define DRIZZLE_VALUE_TYPE_REAL   1
409
 
#define DRIZZLE_VALUE_TYPE_INT    2
 
475
#define MYSQL_VALUE_TYPE_STRING 0
 
476
#define MYSQL_VALUE_TYPE_REAL   1
 
477
#define MYSQL_VALUE_TYPE_INT    2
410
478
 
411
479
struct st_mysql_value
412
480
{
425
493
extern "C" {
426
494
#endif
427
495
 
428
 
int thd_in_lock_tables(const DRIZZLE_THD thd);
429
 
int thd_tablespace_op(const DRIZZLE_THD thd);
430
 
int64_t thd_test_options(const DRIZZLE_THD thd, int64_t test_options);
431
 
int thd_sql_command(const DRIZZLE_THD thd);
432
 
void **thd_ha_data(const DRIZZLE_THD thd, const struct handlerton *hton);
433
 
int thd_tx_isolation(const DRIZZLE_THD thd);
 
496
int thd_in_lock_tables(const MYSQL_THD thd);
 
497
int thd_tablespace_op(const MYSQL_THD thd);
 
498
int64_t thd_test_options(const MYSQL_THD thd, int64_t test_options);
 
499
int thd_sql_command(const MYSQL_THD thd);
 
500
const char *thd_proc_info(MYSQL_THD thd, const char *info);
 
501
void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
 
502
int thd_tx_isolation(const MYSQL_THD thd);
 
503
char *thd_security_context(MYSQL_THD thd, char *buffer, unsigned int length,
 
504
                           unsigned int max_query_len);
434
505
/* Increments the row counter, see THD::row_count */
435
 
void thd_inc_row_count(DRIZZLE_THD thd);
 
506
void thd_inc_row_count(MYSQL_THD thd);
436
507
 
437
508
/**
438
509
  Create a temporary file.
462
533
  @retval 0  the connection is active
463
534
  @retval 1  the connection has been killed
464
535
*/
465
 
int thd_killed(const DRIZZLE_THD thd);
 
536
int thd_killed(const MYSQL_THD thd);
466
537
 
467
538
 
468
539
/**
471
542
  @param thd  user thread connection handle
472
543
  @return  thread id
473
544
*/
474
 
unsigned long thd_get_thread_id(const DRIZZLE_THD thd);
 
545
unsigned long thd_get_thread_id(const MYSQL_THD thd);
475
546
 
476
547
 
477
548
/**
486
557
 
487
558
  @see alloc_root()
488
559
*/
489
 
void *thd_alloc(DRIZZLE_THD thd, unsigned int size);
490
 
/**
491
 
  @see thd_alloc()
492
 
*/
493
 
void *thd_calloc(DRIZZLE_THD thd, unsigned int size);
494
 
/**
495
 
  @see thd_alloc()
496
 
*/
497
 
char *thd_strdup(DRIZZLE_THD thd, const char *str);
498
 
/**
499
 
  @see thd_alloc()
500
 
*/
501
 
char *thd_strmake(DRIZZLE_THD thd, const char *str, unsigned int size);
502
 
/**
503
 
  @see thd_alloc()
504
 
*/
505
 
void *thd_memdup(DRIZZLE_THD thd, const void* str, unsigned int size);
 
560
void *thd_alloc(MYSQL_THD thd, unsigned int size);
 
561
/**
 
562
  @see thd_alloc()
 
563
*/
 
564
void *thd_calloc(MYSQL_THD thd, unsigned int size);
 
565
/**
 
566
  @see thd_alloc()
 
567
*/
 
568
char *thd_strdup(MYSQL_THD thd, const char *str);
 
569
/**
 
570
  @see thd_alloc()
 
571
*/
 
572
char *thd_strmake(MYSQL_THD thd, const char *str, unsigned int size);
 
573
/**
 
574
  @see thd_alloc()
 
575
*/
 
576
void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size);
 
577
 
 
578
/**
 
579
  Create a LEX_STRING in this connection's local memory pool
 
580
 
 
581
  @param thd      user thread connection handle
 
582
  @param lex_str  pointer to LEX_STRING object to be initialized
 
583
  @param str      initializer to be copied into lex_str
 
584
  @param size     length of str, in bytes
 
585
  @param allocate_lex_string  flag: if TRUE, allocate new LEX_STRING object,
 
586
                              instead of using lex_str value
 
587
  @return  NULL on failure, or pointer to the LEX_STRING object
 
588
 
 
589
  @see thd_alloc()
 
590
*/
 
591
MYSQL_LEX_STRING *thd_make_lex_string(MYSQL_THD thd, MYSQL_LEX_STRING *lex_str,
 
592
                                      const char *str, unsigned int size,
 
593
                                      int allocate_lex_string);
506
594
 
507
595
/**
508
596
  Get the XID for this connection's transaction
510
598
  @param thd  user thread connection handle
511
599
  @param xid  location where identifier is stored
512
600
*/
513
 
void thd_get_xid(const DRIZZLE_THD thd, DRIZZLE_XID *xid);
 
601
void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid);
514
602
 
515
603
/**
516
604
  Invalidate the query cache for a given table.
520
608
  @param key_length  length of key in bytes, including the NUL bytes
521
609
  @param using_trx   flag: TRUE if using transactions, FALSE otherwise
522
610
*/
523
 
void mysql_query_cache_invalidate4(DRIZZLE_THD thd,
 
611
void mysql_query_cache_invalidate4(MYSQL_THD thd,
524
612
                                   const char *key, unsigned int key_length,
525
613
                                   int using_trx);
526
614
 
534
622
*/
535
623
inline
536
624
void *
537
 
thd_get_ha_data(const DRIZZLE_THD thd, const struct handlerton *hton)
 
625
thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton)
538
626
{
539
627
  return *thd_ha_data(thd, hton);
540
628
}
544
632
*/
545
633
inline
546
634
void
547
 
thd_set_ha_data(const DRIZZLE_THD thd, const struct handlerton *hton,
 
635
thd_set_ha_data(const MYSQL_THD thd, const struct handlerton *hton,
548
636
                const void *ha_data)
549
637
{
550
638
  *thd_ha_data(thd, hton)= (void*) ha_data;