~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin.h

  • Committer: Stewart Smith
  • Date: 2008-09-15 07:13:59 UTC
  • mfrom: (383.1.21 drizzle)
  • mto: This revision was merged to the branch mainline in revision 408.
  • Revision ID: stewart@flamingspork.com-20080915071359-f8bznznyaiqrtqxa
merged

Show diffs side-by-side

added added

removed removed

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