~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin.h

  • Committer: Brian Aker
  • Date: 2008-08-12 03:12:57 UTC
  • Revision ID: brian@tangent.org-20080812031257-ln3uk87y1r22byeg
First pass of new sql_db.cc 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
25
21
#ifdef __cplusplus
26
22
class THD;
27
23
class Item;
28
 
#define DRIZZLE_THD THD*
 
24
#define MYSQL_THD THD*
29
25
#else
30
 
#define DRIZZLE_THD void*
 
26
#define MYSQL_THD void*
31
27
#endif
32
28
 
33
29
 
39
35
  unsigned int length;
40
36
};
41
37
#endif /* _m_string_h */
42
 
typedef struct st_mysql_lex_string DRIZZLE_LEX_STRING;
 
38
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
43
39
 
44
 
#define DRIZZLE_XIDDATASIZE 128
 
40
#define MYSQL_XIDDATASIZE 128
45
41
/**
46
42
  struct st_mysql_xid is binary compatible with the XID structure as
47
43
  in the X/Open CAE Specification, Distributed Transaction Processing:
54
50
  long formatID;
55
51
  long gtrid_length;
56
52
  long bqual_length;
57
 
  char data[DRIZZLE_XIDDATASIZE];  /* Not \0-terminated */
 
53
  char data[MYSQL_XIDDATASIZE];  /* Not \0-terminated */
58
54
};
59
 
typedef struct st_mysql_xid DRIZZLE_XID;
 
55
typedef struct st_mysql_xid MYSQL_XID;
60
56
 
61
57
/*************************************************************************
62
58
  Plugin API. Common for all plugin types.
65
61
/*
66
62
  The allowable types of plugins
67
63
*/
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 */
 
64
#define MYSQL_DAEMON_PLUGIN          0  /* Daemon / Raw */
 
65
#define MYSQL_STORAGE_ENGINE_PLUGIN  1  /* Storage Engine */
 
66
#define MYSQL_INFORMATION_SCHEMA_PLUGIN  2  /* Information Schema */
 
67
#define MYSQL_UDF_PLUGIN             3  /* User-Defined Function */
 
68
#define MYSQL_UDA_PLUGIN             4  /* User-Defined Aggregate function */
 
69
#define MYSQL_AUDIT_PLUGIN           5  /* Audit */
 
70
#define MYSQL_LOGGER_PLUGIN          6  /* Logging */
 
71
#define MYSQL_AUTH_PLUGIN            7  /* Authorization */
76
72
 
77
 
#define DRIZZLE_MAX_PLUGIN_TYPE_NUM    8  /* The number of plugin types */
 
73
#define MYSQL_MAX_PLUGIN_TYPE_NUM    8  /* The number of plugin types */
78
74
 
79
75
/* We use the following strings to define licenses for plugins */
80
76
#define PLUGIN_LICENSE_PROPRIETARY 0
92
88
*/
93
89
 
94
90
 
95
 
#ifndef DRIZZLE_DYNAMIC_PLUGIN
96
 
#define __DRIZZLE_DECLARE_PLUGIN(NAME, DECLS) \
 
91
#ifndef MYSQL_DYNAMIC_PLUGIN
 
92
#define __MYSQL_DECLARE_PLUGIN(NAME, DECLS) \
97
93
struct st_mysql_plugin DECLS[]= {
98
94
#else
99
 
#define __DRIZZLE_DECLARE_PLUGIN(NAME, DECLS) \
 
95
#define __MYSQL_DECLARE_PLUGIN(NAME, DECLS) \
100
96
struct st_mysql_plugin _mysql_plugin_declarations_[]= {
101
97
#endif
102
98
 
103
99
#define mysql_declare_plugin(NAME) \
104
 
__DRIZZLE_DECLARE_PLUGIN(NAME, \
 
100
__MYSQL_DECLARE_PLUGIN(NAME, \
105
101
                 builtin_ ## NAME ## _plugin)
106
102
 
107
103
#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0}}
124
120
 
125
121
 
126
122
#define SHOW_VAR_FUNC_BUFF_SIZE 1024
127
 
typedef int (*mysql_show_var_func)(DRIZZLE_THD, struct st_mysql_show_var*, char *);
 
123
typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *);
128
124
 
129
125
struct st_show_var_func_container {
130
126
  mysql_show_var_func func;
173
169
  automatically at the end of the statement.
174
170
*/
175
171
 
176
 
typedef int (*mysql_var_check_func)(DRIZZLE_THD thd,
 
172
typedef int (*mysql_var_check_func)(MYSQL_THD thd,
177
173
                                    struct st_mysql_sys_var *var,
178
174
                                    void *save, struct st_mysql_value *value);
179
175
 
191
187
   and persist it in the provided pointer to the dynamic variable.
192
188
   For example, strings may require memory to be allocated.
193
189
*/
194
 
typedef void (*mysql_var_update_func)(DRIZZLE_THD thd,
 
190
typedef void (*mysql_var_update_func)(MYSQL_THD thd,
195
191
                                      struct st_mysql_sys_var *var,
196
192
                                      void *var_ptr, const void *save);
197
193
 
204
200
         PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \
205
201
         PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC)
206
202
 
207
 
#define DRIZZLE_PLUGIN_VAR_HEADER \
 
203
#define MYSQL_PLUGIN_VAR_HEADER \
208
204
  int flags;                    \
209
205
  const char *name;             \
210
206
  const char *comment;          \
211
207
  mysql_var_check_func check;   \
212
208
  mysql_var_update_func update
213
209
 
214
 
#define DRIZZLE_SYSVAR_NAME(name) mysql_sysvar_ ## name
215
 
#define DRIZZLE_SYSVAR(name) \
216
 
  ((struct st_mysql_sys_var *)&(DRIZZLE_SYSVAR_NAME(name)))
 
210
#define MYSQL_SYSVAR_NAME(name) mysql_sysvar_ ## name
 
211
#define MYSQL_SYSVAR(name) \
 
212
  ((struct st_mysql_sys_var *)&(MYSQL_SYSVAR_NAME(name)))
217
213
 
218
214
/*
219
215
  for global variables, the value pointer is the first
223
219
*/
224
220
   
225
221
 
226
 
#define DECLARE_DRIZZLE_SYSVAR_BASIC(name, type) struct { \
227
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
222
#define DECLARE_MYSQL_SYSVAR_BASIC(name, type) struct { \
 
223
  MYSQL_PLUGIN_VAR_HEADER;      \
228
224
  type *value;                  \
229
225
  const type def_val;           \
230
 
} DRIZZLE_SYSVAR_NAME(name)
 
226
} MYSQL_SYSVAR_NAME(name)
231
227
 
232
 
#define DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, type) struct { \
233
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
228
#define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \
 
229
  MYSQL_PLUGIN_VAR_HEADER;      \
234
230
  type *value; type def_val;    \
235
231
  type min_val; type max_val;   \
236
232
  type blk_sz;                  \
237
 
} DRIZZLE_SYSVAR_NAME(name)
 
233
} MYSQL_SYSVAR_NAME(name)
238
234
 
239
 
#define DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, type) struct { \
240
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
235
#define DECLARE_MYSQL_SYSVAR_TYPELIB(name, type) struct { \
 
236
  MYSQL_PLUGIN_VAR_HEADER;      \
241
237
  type *value; type def_val;    \
242
238
  TYPELIB *typelib;             \
243
 
} DRIZZLE_SYSVAR_NAME(name)
 
239
} MYSQL_SYSVAR_NAME(name)
244
240
 
245
241
#define DECLARE_THDVAR_FUNC(type) \
246
 
  type *(*resolve)(DRIZZLE_THD thd, int offset)
 
242
  type *(*resolve)(MYSQL_THD thd, int offset)
247
243
 
248
 
#define DECLARE_DRIZZLE_THDVAR_BASIC(name, type) struct { \
249
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
244
#define DECLARE_MYSQL_THDVAR_BASIC(name, type) struct { \
 
245
  MYSQL_PLUGIN_VAR_HEADER;      \
250
246
  int offset;                   \
251
247
  const type def_val;           \
252
248
  DECLARE_THDVAR_FUNC(type);    \
253
 
} DRIZZLE_SYSVAR_NAME(name)
 
249
} MYSQL_SYSVAR_NAME(name)
254
250
 
255
 
#define DECLARE_DRIZZLE_THDVAR_SIMPLE(name, type) struct { \
256
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
251
#define DECLARE_MYSQL_THDVAR_SIMPLE(name, type) struct { \
 
252
  MYSQL_PLUGIN_VAR_HEADER;      \
257
253
  int offset;                   \
258
254
  type def_val; type min_val;   \
259
255
  type max_val; type blk_sz;    \
260
256
  DECLARE_THDVAR_FUNC(type);    \
261
 
} DRIZZLE_SYSVAR_NAME(name)
 
257
} MYSQL_SYSVAR_NAME(name)
262
258
 
263
 
#define DECLARE_DRIZZLE_THDVAR_TYPELIB(name, type) struct { \
264
 
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
259
#define DECLARE_MYSQL_THDVAR_TYPELIB(name, type) struct { \
 
260
  MYSQL_PLUGIN_VAR_HEADER;      \
265
261
  int offset;                   \
266
262
  type def_val;                 \
267
263
  DECLARE_THDVAR_FUNC(type);    \
268
264
  TYPELIB *typelib;             \
269
 
} DRIZZLE_SYSVAR_NAME(name)
 
265
} MYSQL_SYSVAR_NAME(name)
270
266
 
271
267
 
272
268
/*
273
269
  the following declarations are for use by plugin implementors
274
270
*/
275
271
 
276
 
#define DRIZZLE_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
277
 
DECLARE_DRIZZLE_SYSVAR_BASIC(name, bool) = { \
 
272
#define MYSQL_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
 
273
DECLARE_MYSQL_SYSVAR_BASIC(name, bool) = { \
278
274
  PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \
279
275
  #name, comment, check, update, &varname, def}
280
276
 
281
 
#define DRIZZLE_SYSVAR_STR(name, varname, opt, comment, check, update, def) \
282
 
DECLARE_DRIZZLE_SYSVAR_BASIC(name, char *) = { \
 
277
#define MYSQL_SYSVAR_STR(name, varname, opt, comment, check, update, def) \
 
278
DECLARE_MYSQL_SYSVAR_BASIC(name, char *) = { \
283
279
  PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \
284
280
  #name, comment, check, update, &varname, def}
285
281
 
286
 
#define DRIZZLE_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \
287
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, int) = { \
 
282
#define MYSQL_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \
 
283
DECLARE_MYSQL_SYSVAR_SIMPLE(name, int) = { \
288
284
  PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \
289
285
  #name, comment, check, update, &varname, def, min, max, blk }
290
286
 
291
 
#define DRIZZLE_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \
292
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, unsigned int) = { \
 
287
#define MYSQL_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \
 
288
DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned int) = { \
293
289
  PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
294
290
  #name, comment, check, update, &varname, def, min, max, blk }
295
291
 
296
 
#define DRIZZLE_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \
297
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, long) = { \
 
292
#define MYSQL_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \
 
293
DECLARE_MYSQL_SYSVAR_SIMPLE(name, long) = { \
298
294
  PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \
299
295
  #name, comment, check, update, &varname, def, min, max, blk }
300
296
 
301
 
#define DRIZZLE_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \
302
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, unsigned long) = { \
 
297
#define MYSQL_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \
 
298
DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long) = { \
303
299
  PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
304
300
  #name, comment, check, update, &varname, def, min, max, blk }
305
301
 
306
 
#define DRIZZLE_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
307
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, int64_t) = { \
 
302
#define MYSQL_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
 
303
DECLARE_MYSQL_SYSVAR_SIMPLE(name, int64_t) = { \
308
304
  PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \
309
305
  #name, comment, check, update, &varname, def, min, max, blk }
310
306
 
311
 
#define DRIZZLE_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
312
 
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, uint64_t) = { \
 
307
#define MYSQL_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
 
308
DECLARE_MYSQL_SYSVAR_SIMPLE(name, uint64_t) = { \
313
309
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
314
310
  #name, comment, check, update, &varname, def, min, max, blk }
315
311
 
316
 
#define DRIZZLE_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
317
 
DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, unsigned long) = { \
 
312
#define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
 
313
DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \
318
314
  PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \
319
315
  #name, comment, check, update, &varname, def, typelib }
320
316
 
321
 
#define DRIZZLE_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \
322
 
DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, uint64_t) = { \
 
317
#define MYSQL_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \
 
318
DECLARE_MYSQL_SYSVAR_TYPELIB(name, uint64_t) = { \
323
319
  PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \
324
320
  #name, comment, check, update, &varname, def, typelib }
325
321
 
326
 
#define DRIZZLE_THDVAR_BOOL(name, opt, comment, check, update, def) \
327
 
DECLARE_DRIZZLE_THDVAR_BASIC(name, char) = { \
 
322
#define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \
 
323
DECLARE_MYSQL_THDVAR_BASIC(name, char) = { \
328
324
  PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
329
325
  #name, comment, check, update, -1, def, NULL}
330
326
 
331
 
#define DRIZZLE_THDVAR_STR(name, opt, comment, check, update, def) \
332
 
DECLARE_DRIZZLE_THDVAR_BASIC(name, char *) = { \
 
327
#define MYSQL_THDVAR_STR(name, opt, comment, check, update, def) \
 
328
DECLARE_MYSQL_THDVAR_BASIC(name, char *) = { \
333
329
  PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
334
330
  #name, comment, check, update, -1, def, NULL}
335
331
 
336
 
#define DRIZZLE_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
337
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, int) = { \
 
332
#define MYSQL_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
 
333
DECLARE_MYSQL_THDVAR_SIMPLE(name, int) = { \
338
334
  PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
339
335
  #name, comment, check, update, -1, def, min, max, blk, NULL }
340
336
 
341
 
#define DRIZZLE_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
342
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, unsigned int) = { \
 
337
#define MYSQL_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
 
338
DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned int) = { \
343
339
  PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
344
340
  #name, comment, check, update, -1, def, min, max, blk, NULL }
345
341
 
346
 
#define DRIZZLE_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
347
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, long) = { \
 
342
#define MYSQL_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
 
343
DECLARE_MYSQL_THDVAR_SIMPLE(name, long) = { \
348
344
  PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
349
345
  #name, comment, check, update, -1, def, min, max, blk, NULL }
350
346
 
351
 
#define DRIZZLE_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
352
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, unsigned long) = { \
 
347
#define MYSQL_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
 
348
DECLARE_MYSQL_THDVAR_SIMPLE(name, unsigned long) = { \
353
349
  PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
354
350
  #name, comment, check, update, -1, def, min, max, blk, NULL }
355
351
 
356
 
#define DRIZZLE_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
357
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, int64_t) = { \
 
352
#define MYSQL_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
 
353
DECLARE_MYSQL_THDVAR_SIMPLE(name, int64_t) = { \
358
354
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
359
355
  #name, comment, check, update, -1, def, min, max, blk, NULL }
360
356
 
361
 
#define DRIZZLE_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
362
 
DECLARE_DRIZZLE_THDVAR_SIMPLE(name, uint64_t) = { \
 
357
#define MYSQL_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
 
358
DECLARE_MYSQL_THDVAR_SIMPLE(name, uint64_t) = { \
363
359
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
364
360
  #name, comment, check, update, -1, def, min, max, blk, NULL }
365
361
 
366
 
#define DRIZZLE_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \
367
 
DECLARE_DRIZZLE_THDVAR_TYPELIB(name, unsigned long) = { \
 
362
#define MYSQL_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \
 
363
DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long) = { \
368
364
  PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
369
365
  #name, comment, check, update, -1, def, NULL, typelib }
370
366
 
371
 
#define DRIZZLE_THDVAR_SET(name, opt, comment, check, update, def, typelib) \
372
 
DECLARE_DRIZZLE_THDVAR_TYPELIB(name, uint64_t) = { \
 
367
#define MYSQL_THDVAR_SET(name, opt, comment, check, update, def, typelib) \
 
368
DECLARE_MYSQL_THDVAR_TYPELIB(name, uint64_t) = { \
373
369
  PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
374
370
  #name, comment, check, update, -1, def, NULL, typelib }
375
371
 
376
372
/* accessor macros */
377
373
 
378
374
#define SYSVAR(name) \
379
 
  (*(DRIZZLE_SYSVAR_NAME(name).value))
 
375
  (*(MYSQL_SYSVAR_NAME(name).value))
380
376
 
381
377
/* when thd == null, result points to global value */
382
378
#define THDVAR(thd, name) \
383
 
  (*(DRIZZLE_SYSVAR_NAME(name).resolve(thd, DRIZZLE_SYSVAR_NAME(name).offset)))
 
379
  (*(MYSQL_SYSVAR_NAME(name).resolve(thd, MYSQL_SYSVAR_NAME(name).offset)))
384
380
 
385
381
 
386
382
/*
389
385
 
390
386
struct st_mysql_plugin
391
387
{
392
 
  int type;             /* the plugin type (a DRIZZLE_XXX_PLUGIN value)   */
 
388
  int type;             /* the plugin type (a MYSQL_XXX_PLUGIN value)   */
393
389
  const char *name;     /* plugin name (for SHOW PLUGINS)               */
394
390
  const char *version;  /* plugin version (for SHOW PLUGINS)            */
395
391
  const char *author;   /* plugin author (for SHOW PLUGINS)             */
415
411
  if you need it to persist.
416
412
*/
417
413
 
418
 
#define DRIZZLE_VALUE_TYPE_STRING 0
419
 
#define DRIZZLE_VALUE_TYPE_REAL   1
420
 
#define DRIZZLE_VALUE_TYPE_INT    2
 
414
#define MYSQL_VALUE_TYPE_STRING 0
 
415
#define MYSQL_VALUE_TYPE_REAL   1
 
416
#define MYSQL_VALUE_TYPE_INT    2
421
417
 
422
418
struct st_mysql_value
423
419
{
436
432
extern "C" {
437
433
#endif
438
434
 
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);
 
435
int thd_in_lock_tables(const MYSQL_THD thd);
 
436
int thd_tablespace_op(const MYSQL_THD thd);
 
437
int64_t thd_test_options(const MYSQL_THD thd, int64_t test_options);
 
438
int thd_sql_command(const MYSQL_THD thd);
 
439
const char *thd_proc_info(MYSQL_THD thd, const char *info);
 
440
void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
 
441
int thd_tx_isolation(const MYSQL_THD thd);
446
442
/* Increments the row counter, see THD::row_count */
447
 
void thd_inc_row_count(DRIZZLE_THD thd);
 
443
void thd_inc_row_count(MYSQL_THD thd);
448
444
 
449
445
/**
450
446
  Create a temporary file.
474
470
  @retval 0  the connection is active
475
471
  @retval 1  the connection has been killed
476
472
*/
477
 
int thd_killed(const DRIZZLE_THD thd);
 
473
int thd_killed(const MYSQL_THD thd);
478
474
 
479
475
 
480
476
/**
483
479
  @param thd  user thread connection handle
484
480
  @return  thread id
485
481
*/
486
 
unsigned long thd_get_thread_id(const DRIZZLE_THD thd);
 
482
unsigned long thd_get_thread_id(const MYSQL_THD thd);
487
483
 
488
484
 
489
485
/**
498
494
 
499
495
  @see alloc_root()
500
496
*/
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);
 
497
void *thd_alloc(MYSQL_THD thd, unsigned int size);
 
498
/**
 
499
  @see thd_alloc()
 
500
*/
 
501
void *thd_calloc(MYSQL_THD thd, unsigned int size);
 
502
/**
 
503
  @see thd_alloc()
 
504
*/
 
505
char *thd_strdup(MYSQL_THD thd, const char *str);
 
506
/**
 
507
  @see thd_alloc()
 
508
*/
 
509
char *thd_strmake(MYSQL_THD thd, const char *str, unsigned int size);
 
510
/**
 
511
  @see thd_alloc()
 
512
*/
 
513
void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size);
518
514
 
519
515
/**
520
516
  Create a LEX_STRING in this connection's local memory pool
529
525
 
530
526
  @see thd_alloc()
531
527
*/
532
 
DRIZZLE_LEX_STRING *thd_make_lex_string(DRIZZLE_THD thd, DRIZZLE_LEX_STRING *lex_str,
 
528
MYSQL_LEX_STRING *thd_make_lex_string(MYSQL_THD thd, MYSQL_LEX_STRING *lex_str,
533
529
                                      const char *str, unsigned int size,
534
530
                                      int allocate_lex_string);
535
531
 
539
535
  @param thd  user thread connection handle
540
536
  @param xid  location where identifier is stored
541
537
*/
542
 
void thd_get_xid(const DRIZZLE_THD thd, DRIZZLE_XID *xid);
 
538
void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid);
543
539
 
544
540
/**
545
541
  Invalidate the query cache for a given table.
549
545
  @param key_length  length of key in bytes, including the NUL bytes
550
546
  @param using_trx   flag: TRUE if using transactions, FALSE otherwise
551
547
*/
552
 
void mysql_query_cache_invalidate4(DRIZZLE_THD thd,
 
548
void mysql_query_cache_invalidate4(MYSQL_THD thd,
553
549
                                   const char *key, unsigned int key_length,
554
550
                                   int using_trx);
555
551
 
563
559
*/
564
560
inline
565
561
void *
566
 
thd_get_ha_data(const DRIZZLE_THD thd, const struct handlerton *hton)
 
562
thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton)
567
563
{
568
564
  return *thd_ha_data(thd, hton);
569
565
}
573
569
*/
574
570
inline
575
571
void
576
 
thd_set_ha_data(const DRIZZLE_THD thd, const struct handlerton *hton,
 
572
thd_set_ha_data(const MYSQL_THD thd, const struct handlerton *hton,
577
573
                const void *ha_data)
578
574
{
579
575
  *thd_ha_data(thd, hton)= (void*) ha_data;