~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to include/mysql/plugin.h

  • Committer: Monty Taylor
  • Date: 2008-07-22 05:48:51 UTC
  • mto: (202.1.3 toru)
  • mto: This revision was merged to the branch mainline in revision 204.
  • Revision ID: monty@inaugust.com-20080722054851-airxt73370725p7x
Re-enabled optimizations for the normal build, and added back the --with-debug option to turn them off. 

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.
54
60
/*
55
61
  The allowable types of plugins
56
62
*/
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 */
 
63
#define MYSQL_DAEMON_PLUGIN          0  /* Daemon / Raw */
 
64
#define MYSQL_STORAGE_ENGINE_PLUGIN  1  /* Storage Engine */
 
65
#define MYSQL_INFORMATION_SCHEMA_PLUGIN  2  /* Information Schema */
 
66
#define MYSQL_UDF_PLUGIN             3  /* User-Defined Function */
 
67
#define MYSQL_UDA_PLUGIN             4  /* User-Defined Aggregate function */
 
68
#define MYSQL_AUDIT_PLUGIN           5  /* Audit */
 
69
#define MYSQL_LOGGER_PLUGIN          6  /* Logging */
 
70
#define MYSQL_AUTH_PLUGIN            7  /* Authorization */
65
71
 
66
 
#define DRIZZLE_MAX_PLUGIN_TYPE_NUM    8  /* The number of plugin types */
 
72
#define MYSQL_MAX_PLUGIN_TYPE_NUM    8  /* The number of plugin types */
67
73
 
68
74
/* We use the following strings to define licenses for plugins */
69
75
#define PLUGIN_LICENSE_PROPRIETARY 0
81
87
*/
82
88
 
83
89
 
84
 
#ifndef DRIZZLE_DYNAMIC_PLUGIN
85
 
#define __DRIZZLE_DECLARE_PLUGIN(NAME, DECLS) \
 
90
#ifndef MYSQL_DYNAMIC_PLUGIN
 
91
#define __MYSQL_DECLARE_PLUGIN(NAME, DECLS) \
86
92
struct st_mysql_plugin DECLS[]= {
87
93
#else
88
 
#define __DRIZZLE_DECLARE_PLUGIN(NAME, DECLS) \
 
94
#define __MYSQL_DECLARE_PLUGIN(NAME, DECLS) \
89
95
struct st_mysql_plugin _mysql_plugin_declarations_[]= {
90
96
#endif
91
97
 
92
98
#define mysql_declare_plugin(NAME) \
93
 
__DRIZZLE_DECLARE_PLUGIN(NAME, \
 
99
__MYSQL_DECLARE_PLUGIN(NAME, \
94
100
                 builtin_ ## NAME ## _plugin)
95
101
 
96
102
#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0}}
113
119
 
114
120
 
115
121
#define SHOW_VAR_FUNC_BUFF_SIZE 1024
116
 
typedef int (*mysql_show_var_func)(DRIZZLE_THD, struct st_mysql_show_var*, char *);
 
122
typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *);
117
123
 
118
124
struct st_show_var_func_container {
119
125
  mysql_show_var_func func;
162
168
  automatically at the end of the statement.
163
169
*/
164
170
 
165
 
typedef int (*mysql_var_check_func)(DRIZZLE_THD thd,
 
171
typedef int (*mysql_var_check_func)(MYSQL_THD thd,
166
172
                                    struct st_mysql_sys_var *var,
167
173
                                    void *save, struct st_mysql_value *value);
168
174
 
180
186
   and persist it in the provided pointer to the dynamic variable.
181
187
   For example, strings may require memory to be allocated.
182
188
*/
183
 
typedef void (*mysql_var_update_func)(DRIZZLE_THD thd,
 
189
typedef void (*mysql_var_update_func)(MYSQL_THD thd,
184
190
                                      struct st_mysql_sys_var *var,
185
191
                                      void *var_ptr, const void *save);
186
192
 
193
199
         PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \
194
200
         PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC)
195
201
 
196
 
#define DRIZZLE_PLUGIN_VAR_HEADER \
 
202
#define MYSQL_PLUGIN_VAR_HEADER \
197
203
  int flags;                    \
198
204
  const char *name;             \
199
205
  const char *comment;          \
200
206
  mysql_var_check_func check;   \
201
207
  mysql_var_update_func update
202
208
 
203
 
#define DRIZZLE_SYSVAR_NAME(name) mysql_sysvar_ ## name
204
 
#define DRIZZLE_SYSVAR(name) \
205
 
  ((struct st_mysql_sys_var *)&(DRIZZLE_SYSVAR_NAME(name)))
 
209
#define MYSQL_SYSVAR_NAME(name) mysql_sysvar_ ## name
 
210
#define MYSQL_SYSVAR(name) \
 
211
  ((struct st_mysql_sys_var *)&(MYSQL_SYSVAR_NAME(name)))
206
212
 
207
213
/*
208
214
  for global variables, the value pointer is the first
212
218
*/
213
219
   
214
220
 
215
 
#define DECLARE_DRIZZLE_SYSVAR_BASIC(name, type) struct { \
216
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
221
#define DECLARE_MYSQL_SYSVAR_BASIC(name, type) struct { \
 
222
  MYSQL_PLUGIN_VAR_HEADER;      \
217
223
  type *value;                  \
218
224
  const type def_val;           \
219
 
} DRIZZLE_SYSVAR_NAME(name)
 
225
} MYSQL_SYSVAR_NAME(name)
220
226
 
221
 
#define DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, type) struct { \
222
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
227
#define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \
 
228
  MYSQL_PLUGIN_VAR_HEADER;      \
223
229
  type *value; type def_val;    \
224
230
  type min_val; type max_val;   \
225
231
  type blk_sz;                  \
226
 
} DRIZZLE_SYSVAR_NAME(name)
 
232
} MYSQL_SYSVAR_NAME(name)
227
233
 
228
 
#define DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, type) struct { \
229
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
234
#define DECLARE_MYSQL_SYSVAR_TYPELIB(name, type) struct { \
 
235
  MYSQL_PLUGIN_VAR_HEADER;      \
230
236
  type *value; type def_val;    \
231
237
  TYPELIB *typelib;             \
232
 
} DRIZZLE_SYSVAR_NAME(name)
 
238
} MYSQL_SYSVAR_NAME(name)
233
239
 
234
240
#define DECLARE_THDVAR_FUNC(type) \
235
 
  type *(*resolve)(DRIZZLE_THD thd, int offset)
 
241
  type *(*resolve)(MYSQL_THD thd, int offset)
236
242
 
237
 
#define DECLARE_DRIZZLE_THDVAR_BASIC(name, type) struct { \
238
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
243
#define DECLARE_MYSQL_THDVAR_BASIC(name, type) struct { \
 
244
  MYSQL_PLUGIN_VAR_HEADER;      \
239
245
  int offset;                   \
240
246
  const type def_val;           \
241
247
  DECLARE_THDVAR_FUNC(type);    \
242
 
} DRIZZLE_SYSVAR_NAME(name)
 
248
} MYSQL_SYSVAR_NAME(name)
243
249
 
244
 
#define DECLARE_DRIZZLE_THDVAR_SIMPLE(name, type) struct { \
245
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
250
#define DECLARE_MYSQL_THDVAR_SIMPLE(name, type) struct { \
 
251
  MYSQL_PLUGIN_VAR_HEADER;      \
246
252
  int offset;                   \
247
253
  type def_val; type min_val;   \
248
254
  type max_val; type blk_sz;    \
249
255
  DECLARE_THDVAR_FUNC(type);    \
250
 
} DRIZZLE_SYSVAR_NAME(name)
 
256
} MYSQL_SYSVAR_NAME(name)
251
257
 
252
 
#define DECLARE_DRIZZLE_THDVAR_TYPELIB(name, type) struct { \
253
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
258
#define DECLARE_MYSQL_THDVAR_TYPELIB(name, type) struct { \
 
259
  MYSQL_PLUGIN_VAR_HEADER;      \
254
260
  int offset;                   \
255
261
  type def_val;                 \
256
262
  DECLARE_THDVAR_FUNC(type);    \
257
263
  TYPELIB *typelib;             \
258
 
} DRIZZLE_SYSVAR_NAME(name)
 
264
} MYSQL_SYSVAR_NAME(name)
259
265
 
260
266
 
261
267
/*
262
268
  the following declarations are for use by plugin implementors
263
269
*/
264
270
 
265
 
#define DRIZZLE_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
266
 
DECLARE_DRIZZLE_SYSVAR_BASIC(name, bool) = { \
 
271
#define MYSQL_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
 
272
DECLARE_MYSQL_SYSVAR_BASIC(name, char) = { \
267
273
  PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \
268
274
  #name, comment, check, update, &varname, def}
269
275
 
270
 
#define DRIZZLE_SYSVAR_STR(name, varname, opt, comment, check, update, def) \
271
 
DECLARE_DRIZZLE_SYSVAR_BASIC(name, char *) = { \
 
276
#define MYSQL_SYSVAR_STR(name, varname, opt, comment, check, update, def) \
 
277
DECLARE_MYSQL_SYSVAR_BASIC(name, char *) = { \
272
278
  PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \
273
279
  #name, comment, check, update, &varname, def}
274
280
 
275
 
#define DRIZZLE_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \
276
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, int) = { \
 
281
#define MYSQL_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \
 
282
DECLARE_MYSQL_SYSVAR_SIMPLE(name, int) = { \
277
283
  PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \
278
284
  #name, comment, check, update, &varname, def, min, max, blk }
279
285
 
280
 
#define DRIZZLE_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \
281
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, unsigned int) = { \
 
286
#define MYSQL_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \
 
287
DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned int) = { \
282
288
  PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
283
289
  #name, comment, check, update, &varname, def, min, max, blk }
284
290
 
285
 
#define DRIZZLE_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \
286
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, long) = { \
 
291
#define MYSQL_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \
 
292
DECLARE_MYSQL_SYSVAR_SIMPLE(name, long) = { \
287
293
  PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \
288
294
  #name, comment, check, update, &varname, def, min, max, blk }
289
295
 
290
 
#define DRIZZLE_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \
291
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, unsigned long) = { \
 
296
#define MYSQL_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \
 
297
DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long) = { \
292
298
  PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
293
299
  #name, comment, check, update, &varname, def, min, max, blk }
294
300
 
295
 
#define DRIZZLE_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
296
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, int64_t) = { \
 
301
#define MYSQL_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
 
302
DECLARE_MYSQL_SYSVAR_SIMPLE(name, int64_t) = { \
297
303
  PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \
298
304
  #name, comment, check, update, &varname, def, min, max, blk }
299
305
 
300
 
#define DRIZZLE_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
301
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, uint64_t) = { \
 
306
#define MYSQL_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
 
307
DECLARE_MYSQL_SYSVAR_SIMPLE(name, uint64_t) = { \
302
308
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
303
309
  #name, comment, check, update, &varname, def, min, max, blk }
304
310
 
305
 
#define DRIZZLE_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
306
 
DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, unsigned long) = { \
 
311
#define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
 
312
DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \
307
313
  PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \
308
314
  #name, comment, check, update, &varname, def, typelib }
309
315
 
310
 
#define DRIZZLE_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \
311
 
DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, uint64_t) = { \
 
316
#define MYSQL_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \
 
317
DECLARE_MYSQL_SYSVAR_TYPELIB(name, uint64_t) = { \
312
318
  PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \
313
319
  #name, comment, check, update, &varname, def, typelib }
314
320
 
315
 
#define DRIZZLE_THDVAR_BOOL(name, opt, comment, check, update, def) \
316
 
DECLARE_DRIZZLE_THDVAR_BASIC(name, char) = { \
 
321
#define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \
 
322
DECLARE_MYSQL_THDVAR_BASIC(name, char) = { \
317
323
  PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
318
324
  #name, comment, check, update, -1, def, NULL}
319
325
 
320
 
#define DRIZZLE_THDVAR_STR(name, opt, comment, check, update, def) \
321
 
DECLARE_DRIZZLE_THDVAR_BASIC(name, char *) = { \
 
326
#define MYSQL_THDVAR_STR(name, opt, comment, check, update, def) \
 
327
DECLARE_MYSQL_THDVAR_BASIC(name, char *) = { \
322
328
  PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
323
329
  #name, comment, check, update, -1, def, NULL}
324
330
 
325
 
#define DRIZZLE_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
326
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, int) = { \
 
331
#define MYSQL_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
 
332
DECLARE_MYSQL_THDVAR_SIMPLE(name, int) = { \
327
333
  PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
328
334
  #name, comment, check, update, -1, def, min, max, blk, NULL }
329
335
 
330
 
#define DRIZZLE_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
331
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, unsigned int) = { \
 
336
#define MYSQL_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
 
337
DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned int) = { \
332
338
  PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
333
339
  #name, comment, check, update, -1, def, min, max, blk, NULL }
334
340
 
335
 
#define DRIZZLE_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
336
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, long) = { \
 
341
#define MYSQL_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
 
342
DECLARE_MYSQL_THDVAR_SIMPLE(name, long) = { \
337
343
  PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
338
344
  #name, comment, check, update, -1, def, min, max, blk, NULL }
339
345
 
340
 
#define DRIZZLE_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
341
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, unsigned long) = { \
 
346
#define MYSQL_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
 
347
DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long) = { \
342
348
  PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
343
349
  #name, comment, check, update, -1, def, min, max, blk, NULL }
344
350
 
345
 
#define DRIZZLE_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
346
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, int64_t) = { \
 
351
#define MYSQL_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
 
352
DECLARE_MYSQL_THDVAR_SIMPLE(name, int64_t) = { \
347
353
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
348
354
  #name, comment, check, update, -1, def, min, max, blk, NULL }
349
355
 
350
 
#define DRIZZLE_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
351
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, uint64_t) = { \
 
356
#define MYSQL_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
 
357
DECLARE_MYSQL_THDVAR_SIMPLE(name, uint64_t) = { \
352
358
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
353
359
  #name, comment, check, update, -1, def, min, max, blk, NULL }
354
360
 
355
 
#define DRIZZLE_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \
356
 
DECLARE_DRIZZLE_THDVAR_TYPELIB(name, unsigned long) = { \
 
361
#define MYSQL_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \
 
362
DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long) = { \
357
363
  PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
358
364
  #name, comment, check, update, -1, def, NULL, typelib }
359
365
 
360
 
#define DRIZZLE_THDVAR_SET(name, opt, comment, check, update, def, typelib) \
361
 
DECLARE_DRIZZLE_THDVAR_TYPELIB(name, uint64_t) = { \
 
366
#define MYSQL_THDVAR_SET(name, opt, comment, check, update, def, typelib) \
 
367
DECLARE_MYSQL_THDVAR_TYPELIB(name, uint64_t) = { \
362
368
  PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
363
369
  #name, comment, check, update, -1, def, NULL, typelib }
364
370
 
365
371
/* accessor macros */
366
372
 
367
373
#define SYSVAR(name) \
368
 
  (*(DRIZZLE_SYSVAR_NAME(name).value))
 
374
  (*(MYSQL_SYSVAR_NAME(name).value))
369
375
 
370
376
/* when thd == null, result points to global value */
371
377
#define THDVAR(thd, name) \
372
 
  (*(DRIZZLE_SYSVAR_NAME(name).resolve(thd, DRIZZLE_SYSVAR_NAME(name).offset)))
 
378
  (*(MYSQL_SYSVAR_NAME(name).resolve(thd, MYSQL_SYSVAR_NAME(name).offset)))
373
379
 
374
380
 
375
381
/*
378
384
 
379
385
struct st_mysql_plugin
380
386
{
381
 
  int type;             /* the plugin type (a DRIZZLE_XXX_PLUGIN value)   */
 
387
  int type;             /* the plugin type (a MYSQL_XXX_PLUGIN value)   */
382
388
  const char *name;     /* plugin name (for SHOW PLUGINS)               */
383
389
  const char *version;  /* plugin version (for SHOW PLUGINS)            */
384
390
  const char *author;   /* plugin author (for SHOW PLUGINS)             */
404
410
  if you need it to persist.
405
411
*/
406
412
 
407
 
#define DRIZZLE_VALUE_TYPE_STRING 0
408
 
#define DRIZZLE_VALUE_TYPE_REAL   1
409
 
#define DRIZZLE_VALUE_TYPE_INT    2
 
413
#define MYSQL_VALUE_TYPE_STRING 0
 
414
#define MYSQL_VALUE_TYPE_REAL   1
 
415
#define MYSQL_VALUE_TYPE_INT    2
410
416
 
411
417
struct st_mysql_value
412
418
{
425
431
extern "C" {
426
432
#endif
427
433
 
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);
 
434
int thd_in_lock_tables(const MYSQL_THD thd);
 
435
int thd_tablespace_op(const MYSQL_THD thd);
 
436
int64_t thd_test_options(const MYSQL_THD thd, int64_t test_options);
 
437
int thd_sql_command(const MYSQL_THD thd);
 
438
const char *thd_proc_info(MYSQL_THD thd, const char *info);
 
439
void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
 
440
int thd_tx_isolation(const MYSQL_THD thd);
 
441
char *thd_security_context(MYSQL_THD thd, char *buffer, unsigned int length,
 
442
                           unsigned int max_query_len);
434
443
/* Increments the row counter, see THD::row_count */
435
 
void thd_inc_row_count(DRIZZLE_THD thd);
 
444
void thd_inc_row_count(MYSQL_THD thd);
436
445
 
437
446
/**
438
447
  Create a temporary file.
462
471
  @retval 0  the connection is active
463
472
  @retval 1  the connection has been killed
464
473
*/
465
 
int thd_killed(const DRIZZLE_THD thd);
 
474
int thd_killed(const MYSQL_THD thd);
466
475
 
467
476
 
468
477
/**
471
480
  @param thd  user thread connection handle
472
481
  @return  thread id
473
482
*/
474
 
unsigned long thd_get_thread_id(const DRIZZLE_THD thd);
 
483
unsigned long thd_get_thread_id(const MYSQL_THD thd);
475
484
 
476
485
 
477
486
/**
486
495
 
487
496
  @see alloc_root()
488
497
*/
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);
 
498
void *thd_alloc(MYSQL_THD thd, unsigned int size);
 
499
/**
 
500
  @see thd_alloc()
 
501
*/
 
502
void *thd_calloc(MYSQL_THD thd, unsigned int size);
 
503
/**
 
504
  @see thd_alloc()
 
505
*/
 
506
char *thd_strdup(MYSQL_THD thd, const char *str);
 
507
/**
 
508
  @see thd_alloc()
 
509
*/
 
510
char *thd_strmake(MYSQL_THD thd, const char *str, unsigned int size);
 
511
/**
 
512
  @see thd_alloc()
 
513
*/
 
514
void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size);
 
515
 
 
516
/**
 
517
  Create a LEX_STRING in this connection's local memory pool
 
518
 
 
519
  @param thd      user thread connection handle
 
520
  @param lex_str  pointer to LEX_STRING object to be initialized
 
521
  @param str      initializer to be copied into lex_str
 
522
  @param size     length of str, in bytes
 
523
  @param allocate_lex_string  flag: if TRUE, allocate new LEX_STRING object,
 
524
                              instead of using lex_str value
 
525
  @return  NULL on failure, or pointer to the LEX_STRING object
 
526
 
 
527
  @see thd_alloc()
 
528
*/
 
529
MYSQL_LEX_STRING *thd_make_lex_string(MYSQL_THD thd, MYSQL_LEX_STRING *lex_str,
 
530
                                      const char *str, unsigned int size,
 
531
                                      int allocate_lex_string);
506
532
 
507
533
/**
508
534
  Get the XID for this connection's transaction
510
536
  @param thd  user thread connection handle
511
537
  @param xid  location where identifier is stored
512
538
*/
513
 
void thd_get_xid(const DRIZZLE_THD thd, DRIZZLE_XID *xid);
 
539
void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid);
514
540
 
515
541
/**
516
542
  Invalidate the query cache for a given table.
520
546
  @param key_length  length of key in bytes, including the NUL bytes
521
547
  @param using_trx   flag: TRUE if using transactions, FALSE otherwise
522
548
*/
523
 
void mysql_query_cache_invalidate4(DRIZZLE_THD thd,
 
549
void mysql_query_cache_invalidate4(MYSQL_THD thd,
524
550
                                   const char *key, unsigned int key_length,
525
551
                                   int using_trx);
526
552
 
534
560
*/
535
561
inline
536
562
void *
537
 
thd_get_ha_data(const DRIZZLE_THD thd, const struct handlerton *hton)
 
563
thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton)
538
564
{
539
565
  return *thd_ha_data(thd, hton);
540
566
}
544
570
*/
545
571
inline
546
572
void
547
 
thd_set_ha_data(const DRIZZLE_THD thd, const struct handlerton *hton,
 
573
thd_set_ha_data(const MYSQL_THD thd, const struct handlerton *hton,
548
574
                const void *ha_data)
549
575
{
550
576
  *thd_ha_data(thd, hton)= (void*) ha_data;