~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to include/mysql/plugin.h

  • Committer: Monty Taylor
  • Date: 2008-07-05 11:20:18 UTC
  • mto: This revision was merged to the branch mainline in revision 62.
  • Revision ID: monty@inaugust.com-20080705112018-fr12kkmgphtu7m29
Changes so that removal of duplicate curr_dir from my_sys.h work.

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
 
 
27
#include <stdint.h>
33
28
 
34
29
#ifndef _m_string_h
35
30
/* This definition must match the one given in m_string.h */
39
34
  unsigned int length;
40
35
};
41
36
#endif /* _m_string_h */
42
 
typedef struct st_mysql_lex_string DRIZZLE_LEX_STRING;
 
37
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
43
38
 
44
 
#define DRIZZLE_XIDDATASIZE 128
 
39
#define MYSQL_XIDDATASIZE 128
45
40
/**
46
41
  struct st_mysql_xid is binary compatible with the XID structure as
47
42
  in the X/Open CAE Specification, Distributed Transaction Processing:
54
49
  long formatID;
55
50
  long gtrid_length;
56
51
  long bqual_length;
57
 
  char data[DRIZZLE_XIDDATASIZE];  /* Not \0-terminated */
 
52
  char data[MYSQL_XIDDATASIZE];  /* Not \0-terminated */
58
53
};
59
 
typedef struct st_mysql_xid DRIZZLE_XID;
 
54
typedef struct st_mysql_xid MYSQL_XID;
60
55
 
61
56
/*************************************************************************
62
57
  Plugin API. Common for all plugin types.
63
58
*/
64
59
 
 
60
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0100
 
61
 
65
62
/*
66
63
  The allowable types of plugins
67
64
*/
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 */
76
 
 
77
 
#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   */
78
72
 
79
73
/* We use the following strings to define licenses for plugins */
80
74
#define PLUGIN_LICENSE_PROPRIETARY 0
92
86
*/
93
87
 
94
88
 
95
 
#ifndef DRIZZLE_DYNAMIC_PLUGIN
96
 
#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);                                    \
97
93
struct st_mysql_plugin DECLS[]= {
98
94
#else
99
 
#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);          \
100
98
struct st_mysql_plugin _mysql_plugin_declarations_[]= {
101
99
#endif
102
100
 
103
101
#define mysql_declare_plugin(NAME) \
104
 
__DRIZZLE_DECLARE_PLUGIN(NAME, \
 
102
__MYSQL_DECLARE_PLUGIN(NAME, \
 
103
                 builtin_ ## NAME ## _plugin_interface_version, \
 
104
                 builtin_ ## NAME ## _sizeof_struct_st_plugin, \
105
105
                 builtin_ ## NAME ## _plugin)
106
106
 
107
 
#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}}
108
108
 
109
109
/*
110
110
  declarations for SHOW STATUS support in plugins
122
122
  enum enum_mysql_show_type type;
123
123
};
124
124
 
125
 
 
126
125
#define SHOW_VAR_FUNC_BUFF_SIZE 1024
127
 
typedef int (*mysql_show_var_func)(DRIZZLE_THD, struct st_mysql_show_var*, char *);
128
 
 
129
 
struct st_show_var_func_container {
130
 
  mysql_show_var_func func;
131
 
};
 
126
typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *);
 
127
 
 
128
 
132
129
/*
133
130
  declarations for server variables and command line options
134
131
*/
173
170
  automatically at the end of the statement.
174
171
*/
175
172
 
176
 
typedef int (*mysql_var_check_func)(DRIZZLE_THD thd,
 
173
typedef int (*mysql_var_check_func)(MYSQL_THD thd,
177
174
                                    struct st_mysql_sys_var *var,
178
175
                                    void *save, struct st_mysql_value *value);
179
176
 
191
188
   and persist it in the provided pointer to the dynamic variable.
192
189
   For example, strings may require memory to be allocated.
193
190
*/
194
 
typedef void (*mysql_var_update_func)(DRIZZLE_THD thd,
 
191
typedef void (*mysql_var_update_func)(MYSQL_THD thd,
195
192
                                      struct st_mysql_sys_var *var,
196
193
                                      void *var_ptr, const void *save);
197
194
 
204
201
         PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \
205
202
         PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC)
206
203
 
207
 
#define DRIZZLE_PLUGIN_VAR_HEADER \
 
204
#define MYSQL_PLUGIN_VAR_HEADER \
208
205
  int flags;                    \
209
206
  const char *name;             \
210
207
  const char *comment;          \
211
208
  mysql_var_check_func check;   \
212
209
  mysql_var_update_func update
213
210
 
214
 
#define DRIZZLE_SYSVAR_NAME(name) mysql_sysvar_ ## name
215
 
#define DRIZZLE_SYSVAR(name) \
216
 
  ((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)))
217
214
 
218
215
/*
219
216
  for global variables, the value pointer is the first
223
220
*/
224
221
   
225
222
 
226
 
#define DECLARE_DRIZZLE_SYSVAR_BASIC(name, type) struct { \
227
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
223
#define DECLARE_MYSQL_SYSVAR_BASIC(name, type) struct { \
 
224
  MYSQL_PLUGIN_VAR_HEADER;      \
228
225
  type *value;                  \
229
226
  const type def_val;           \
230
 
} DRIZZLE_SYSVAR_NAME(name)
 
227
} MYSQL_SYSVAR_NAME(name)
231
228
 
232
 
#define DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, type) struct { \
233
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
229
#define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \
 
230
  MYSQL_PLUGIN_VAR_HEADER;      \
234
231
  type *value; type def_val;    \
235
232
  type min_val; type max_val;   \
236
233
  type blk_sz;                  \
237
 
} DRIZZLE_SYSVAR_NAME(name)
 
234
} MYSQL_SYSVAR_NAME(name)
238
235
 
239
 
#define DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, type) struct { \
240
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
236
#define DECLARE_MYSQL_SYSVAR_TYPELIB(name, type) struct { \
 
237
  MYSQL_PLUGIN_VAR_HEADER;      \
241
238
  type *value; type def_val;    \
242
239
  TYPELIB *typelib;             \
243
 
} DRIZZLE_SYSVAR_NAME(name)
 
240
} MYSQL_SYSVAR_NAME(name)
244
241
 
245
242
#define DECLARE_THDVAR_FUNC(type) \
246
 
  type *(*resolve)(DRIZZLE_THD thd, int offset)
 
243
  type *(*resolve)(MYSQL_THD thd, int offset)
247
244
 
248
 
#define DECLARE_DRIZZLE_THDVAR_BASIC(name, type) struct { \
249
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
245
#define DECLARE_MYSQL_THDVAR_BASIC(name, type) struct { \
 
246
  MYSQL_PLUGIN_VAR_HEADER;      \
250
247
  int offset;                   \
251
248
  const type def_val;           \
252
249
  DECLARE_THDVAR_FUNC(type);    \
253
 
} DRIZZLE_SYSVAR_NAME(name)
 
250
} MYSQL_SYSVAR_NAME(name)
254
251
 
255
 
#define DECLARE_DRIZZLE_THDVAR_SIMPLE(name, type) struct { \
256
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
252
#define DECLARE_MYSQL_THDVAR_SIMPLE(name, type) struct { \
 
253
  MYSQL_PLUGIN_VAR_HEADER;      \
257
254
  int offset;                   \
258
255
  type def_val; type min_val;   \
259
256
  type max_val; type blk_sz;    \
260
257
  DECLARE_THDVAR_FUNC(type);    \
261
 
} DRIZZLE_SYSVAR_NAME(name)
 
258
} MYSQL_SYSVAR_NAME(name)
262
259
 
263
 
#define DECLARE_DRIZZLE_THDVAR_TYPELIB(name, type) struct { \
264
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
260
#define DECLARE_MYSQL_THDVAR_TYPELIB(name, type) struct { \
 
261
  MYSQL_PLUGIN_VAR_HEADER;      \
265
262
  int offset;                   \
266
263
  type def_val;                 \
267
264
  DECLARE_THDVAR_FUNC(type);    \
268
265
  TYPELIB *typelib;             \
269
 
} DRIZZLE_SYSVAR_NAME(name)
 
266
} MYSQL_SYSVAR_NAME(name)
270
267
 
271
268
 
272
269
/*
273
270
  the following declarations are for use by plugin implementors
274
271
*/
275
272
 
276
 
#define DRIZZLE_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
277
 
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) = { \
278
275
  PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \
279
276
  #name, comment, check, update, &varname, def}
280
277
 
281
 
#define DRIZZLE_SYSVAR_STR(name, varname, opt, comment, check, update, def) \
282
 
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 *) = { \
283
280
  PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \
284
281
  #name, comment, check, update, &varname, def}
285
282
 
286
 
#define DRIZZLE_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \
287
 
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) = { \
288
285
  PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \
289
286
  #name, comment, check, update, &varname, def, min, max, blk }
290
287
 
291
 
#define DRIZZLE_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \
292
 
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) = { \
293
290
  PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
294
291
  #name, comment, check, update, &varname, def, min, max, blk }
295
292
 
296
 
#define DRIZZLE_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \
297
 
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) = { \
298
295
  PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \
299
296
  #name, comment, check, update, &varname, def, min, max, blk }
300
297
 
301
 
#define DRIZZLE_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \
302
 
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) = { \
303
300
  PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
304
301
  #name, comment, check, update, &varname, def, min, max, blk }
305
302
 
306
 
#define DRIZZLE_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
307
 
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) = { \
308
305
  PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \
309
306
  #name, comment, check, update, &varname, def, min, max, blk }
310
307
 
311
 
#define DRIZZLE_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
312
 
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) = { \
313
310
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
314
311
  #name, comment, check, update, &varname, def, min, max, blk }
315
312
 
316
 
#define DRIZZLE_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
317
 
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) = { \
318
315
  PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \
319
316
  #name, comment, check, update, &varname, def, typelib }
320
317
 
321
 
#define DRIZZLE_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \
322
 
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) = { \
323
320
  PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \
324
321
  #name, comment, check, update, &varname, def, typelib }
325
322
 
326
 
#define DRIZZLE_THDVAR_BOOL(name, opt, comment, check, update, def) \
327
 
DECLARE_DRIZZLE_THDVAR_BASIC(name, char) = { \
 
323
#define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \
 
324
DECLARE_MYSQL_THDVAR_BASIC(name, char) = { \
328
325
  PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
329
326
  #name, comment, check, update, -1, def, NULL}
330
327
 
331
 
#define DRIZZLE_THDVAR_STR(name, opt, comment, check, update, def) \
332
 
DECLARE_DRIZZLE_THDVAR_BASIC(name, char *) = { \
 
328
#define MYSQL_THDVAR_STR(name, opt, comment, check, update, def) \
 
329
DECLARE_MYSQL_THDVAR_BASIC(name, char *) = { \
333
330
  PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
334
331
  #name, comment, check, update, -1, def, NULL}
335
332
 
336
 
#define DRIZZLE_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
337
 
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) = { \
338
335
  PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
339
336
  #name, comment, check, update, -1, def, min, max, blk, NULL }
340
337
 
341
 
#define DRIZZLE_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
342
 
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) = { \
343
340
  PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
344
341
  #name, comment, check, update, -1, def, min, max, blk, NULL }
345
342
 
346
 
#define DRIZZLE_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
347
 
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) = { \
348
345
  PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
349
346
  #name, comment, check, update, -1, def, min, max, blk, NULL }
350
347
 
351
 
#define DRIZZLE_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
352
 
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) = { \
353
350
  PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
354
351
  #name, comment, check, update, -1, def, min, max, blk, NULL }
355
352
 
356
 
#define DRIZZLE_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
357
 
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) = { \
358
355
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
359
356
  #name, comment, check, update, -1, def, min, max, blk, NULL }
360
357
 
361
 
#define DRIZZLE_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
362
 
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) = { \
363
360
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
364
361
  #name, comment, check, update, -1, def, min, max, blk, NULL }
365
362
 
366
 
#define DRIZZLE_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \
367
 
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) = { \
368
365
  PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
369
366
  #name, comment, check, update, -1, def, NULL, typelib }
370
367
 
371
 
#define DRIZZLE_THDVAR_SET(name, opt, comment, check, update, def, typelib) \
372
 
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) = { \
373
370
  PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
374
371
  #name, comment, check, update, -1, def, NULL, typelib }
375
372
 
376
373
/* accessor macros */
377
374
 
378
375
#define SYSVAR(name) \
379
 
  (*(DRIZZLE_SYSVAR_NAME(name).value))
 
376
  (*(MYSQL_SYSVAR_NAME(name).value))
380
377
 
381
378
/* when thd == null, result points to global value */
382
379
#define THDVAR(thd, name) \
383
 
  (*(DRIZZLE_SYSVAR_NAME(name).resolve(thd, DRIZZLE_SYSVAR_NAME(name).offset)))
 
380
  (*(MYSQL_SYSVAR_NAME(name).resolve(thd, MYSQL_SYSVAR_NAME(name).offset)))
384
381
 
385
382
 
386
383
/*
389
386
 
390
387
struct st_mysql_plugin
391
388
{
392
 
  int type;             /* the plugin type (a DRIZZLE_XXX_PLUGIN value)   */
393
 
  const char *name;     /* plugin name (for SHOW PLUGINS)               */
394
 
  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                                  */
395
392
  const char *author;   /* plugin author (for SHOW PLUGINS)             */
396
393
  const char *descr;    /* general descriptive text (for SHOW PLUGINS ) */
397
394
  int license;          /* the plugin license (PLUGIN_LICENSE_XXX)      */
398
395
  int (*init)(void *);  /* the function to invoke when plugin is loaded */
399
396
  int (*deinit)(void *);/* the function to invoke when plugin is unloaded */
 
397
  unsigned int version; /* plugin version (for SHOW PLUGINS)            */
400
398
  struct st_mysql_show_var *status_vars;
401
399
  struct st_mysql_sys_var **system_vars;
402
400
  void * __reserved1;   /* reserved for dependency checking             */
403
401
};
404
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
 
405
462
struct handlerton;
406
463
 
407
464
 
415
472
  if you need it to persist.
416
473
*/
417
474
 
418
 
#define DRIZZLE_VALUE_TYPE_STRING 0
419
 
#define DRIZZLE_VALUE_TYPE_REAL   1
420
 
#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
421
478
 
422
479
struct st_mysql_value
423
480
{
436
493
extern "C" {
437
494
#endif
438
495
 
439
 
int thd_in_lock_tables(const DRIZZLE_THD thd);
440
 
int thd_tablespace_op(const DRIZZLE_THD thd);
441
 
int64_t thd_test_options(const DRIZZLE_THD thd, int64_t test_options);
442
 
int thd_sql_command(const DRIZZLE_THD thd);
443
 
const char *thd_proc_info(DRIZZLE_THD thd, const char *info);
444
 
void **thd_ha_data(const DRIZZLE_THD thd, const struct handlerton *hton);
445
 
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);
446
505
/* Increments the row counter, see THD::row_count */
447
 
void thd_inc_row_count(DRIZZLE_THD thd);
 
506
void thd_inc_row_count(MYSQL_THD thd);
448
507
 
449
508
/**
450
509
  Create a temporary file.
474
533
  @retval 0  the connection is active
475
534
  @retval 1  the connection has been killed
476
535
*/
477
 
int thd_killed(const DRIZZLE_THD thd);
 
536
int thd_killed(const MYSQL_THD thd);
478
537
 
479
538
 
480
539
/**
483
542
  @param thd  user thread connection handle
484
543
  @return  thread id
485
544
*/
486
 
unsigned long thd_get_thread_id(const DRIZZLE_THD thd);
 
545
unsigned long thd_get_thread_id(const MYSQL_THD thd);
487
546
 
488
547
 
489
548
/**
498
557
 
499
558
  @see alloc_root()
500
559
*/
501
 
void *thd_alloc(DRIZZLE_THD thd, unsigned int size);
502
 
/**
503
 
  @see thd_alloc()
504
 
*/
505
 
void *thd_calloc(DRIZZLE_THD thd, unsigned int size);
506
 
/**
507
 
  @see thd_alloc()
508
 
*/
509
 
char *thd_strdup(DRIZZLE_THD thd, const char *str);
510
 
/**
511
 
  @see thd_alloc()
512
 
*/
513
 
char *thd_strmake(DRIZZLE_THD thd, const char *str, unsigned int size);
514
 
/**
515
 
  @see thd_alloc()
516
 
*/
517
 
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);
518
577
 
519
578
/**
520
579
  Create a LEX_STRING in this connection's local memory pool
529
588
 
530
589
  @see thd_alloc()
531
590
*/
532
 
DRIZZLE_LEX_STRING *thd_make_lex_string(DRIZZLE_THD thd, DRIZZLE_LEX_STRING *lex_str,
 
591
MYSQL_LEX_STRING *thd_make_lex_string(MYSQL_THD thd, MYSQL_LEX_STRING *lex_str,
533
592
                                      const char *str, unsigned int size,
534
593
                                      int allocate_lex_string);
535
594
 
539
598
  @param thd  user thread connection handle
540
599
  @param xid  location where identifier is stored
541
600
*/
542
 
void thd_get_xid(const DRIZZLE_THD thd, DRIZZLE_XID *xid);
 
601
void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid);
543
602
 
544
603
/**
545
604
  Invalidate the query cache for a given table.
549
608
  @param key_length  length of key in bytes, including the NUL bytes
550
609
  @param using_trx   flag: TRUE if using transactions, FALSE otherwise
551
610
*/
552
 
void mysql_query_cache_invalidate4(DRIZZLE_THD thd,
 
611
void mysql_query_cache_invalidate4(MYSQL_THD thd,
553
612
                                   const char *key, unsigned int key_length,
554
613
                                   int using_trx);
555
614
 
563
622
*/
564
623
inline
565
624
void *
566
 
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)
567
626
{
568
627
  return *thd_ha_data(thd, hton);
569
628
}
573
632
*/
574
633
inline
575
634
void
576
 
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,
577
636
                const void *ha_data)
578
637
{
579
638
  *thd_ha_data(thd, hton)= (void*) ha_data;