222
#define DECLARE_MYSQL_SYSVAR_BASIC(name, type) struct { \
223
MYSQL_PLUGIN_VAR_HEADER; \
222
#define DECLARE_DRIZZLE_SYSVAR_BASIC(name, type) struct { \
223
DRIZZLE_PLUGIN_VAR_HEADER; \
225
225
const type def_val; \
226
} MYSQL_SYSVAR_NAME(name)
226
} DRIZZLE_SYSVAR_NAME(name)
228
#define DECLARE_MYSQL_SYSVAR_SIMPLE(name, type) struct { \
229
MYSQL_PLUGIN_VAR_HEADER; \
228
#define DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, type) struct { \
229
DRIZZLE_PLUGIN_VAR_HEADER; \
230
230
type *value; type def_val; \
231
231
type min_val; type max_val; \
233
} MYSQL_SYSVAR_NAME(name)
233
} DRIZZLE_SYSVAR_NAME(name)
235
#define DECLARE_MYSQL_SYSVAR_TYPELIB(name, type) struct { \
236
MYSQL_PLUGIN_VAR_HEADER; \
235
#define DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, type) struct { \
236
DRIZZLE_PLUGIN_VAR_HEADER; \
237
237
type *value; type def_val; \
238
238
TYPELIB *typelib; \
239
} MYSQL_SYSVAR_NAME(name)
239
} DRIZZLE_SYSVAR_NAME(name)
241
241
#define DECLARE_THDVAR_FUNC(type) \
242
type *(*resolve)(MYSQL_THD thd, int offset)
242
type *(*resolve)(DRIZZLE_THD thd, int offset)
244
#define DECLARE_MYSQL_THDVAR_BASIC(name, type) struct { \
245
MYSQL_PLUGIN_VAR_HEADER; \
244
#define DECLARE_DRIZZLE_THDVAR_BASIC(name, type) struct { \
245
DRIZZLE_PLUGIN_VAR_HEADER; \
247
247
const type def_val; \
248
248
DECLARE_THDVAR_FUNC(type); \
249
} MYSQL_SYSVAR_NAME(name)
249
} DRIZZLE_SYSVAR_NAME(name)
251
#define DECLARE_MYSQL_THDVAR_SIMPLE(name, type) struct { \
252
MYSQL_PLUGIN_VAR_HEADER; \
251
#define DECLARE_DRIZZLE_THDVAR_SIMPLE(name, type) struct { \
252
DRIZZLE_PLUGIN_VAR_HEADER; \
254
254
type def_val; type min_val; \
255
255
type max_val; type blk_sz; \
256
256
DECLARE_THDVAR_FUNC(type); \
257
} MYSQL_SYSVAR_NAME(name)
257
} DRIZZLE_SYSVAR_NAME(name)
259
#define DECLARE_MYSQL_THDVAR_TYPELIB(name, type) struct { \
260
MYSQL_PLUGIN_VAR_HEADER; \
259
#define DECLARE_DRIZZLE_THDVAR_TYPELIB(name, type) struct { \
260
DRIZZLE_PLUGIN_VAR_HEADER; \
263
263
DECLARE_THDVAR_FUNC(type); \
264
264
TYPELIB *typelib; \
265
} MYSQL_SYSVAR_NAME(name)
265
} DRIZZLE_SYSVAR_NAME(name)
269
269
the following declarations are for use by plugin implementors
272
#define MYSQL_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
273
DECLARE_MYSQL_SYSVAR_BASIC(name, bool) = { \
272
#define DRIZZLE_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
273
DECLARE_DRIZZLE_SYSVAR_BASIC(name, bool) = { \
274
274
PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \
275
275
#name, comment, check, update, &varname, def}
277
#define MYSQL_SYSVAR_STR(name, varname, opt, comment, check, update, def) \
278
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 *) = { \
279
279
PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \
280
280
#name, comment, check, update, &varname, def}
282
#define MYSQL_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \
283
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) = { \
284
284
PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \
285
285
#name, comment, check, update, &varname, def, min, max, blk }
287
#define MYSQL_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \
288
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) = { \
289
289
PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
290
290
#name, comment, check, update, &varname, def, min, max, blk }
292
#define MYSQL_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \
293
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) = { \
294
294
PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \
295
295
#name, comment, check, update, &varname, def, min, max, blk }
297
#define MYSQL_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \
298
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) = { \
299
299
PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
300
300
#name, comment, check, update, &varname, def, min, max, blk }
302
#define MYSQL_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
303
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) = { \
304
304
PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \
305
305
#name, comment, check, update, &varname, def, min, max, blk }
307
#define MYSQL_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
308
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) = { \
309
309
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
310
310
#name, comment, check, update, &varname, def, min, max, blk }
312
#define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
313
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) = { \
314
314
PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \
315
315
#name, comment, check, update, &varname, def, typelib }
317
#define MYSQL_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \
318
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) = { \
319
319
PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \
320
320
#name, comment, check, update, &varname, def, typelib }
322
#define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \
323
DECLARE_MYSQL_THDVAR_BASIC(name, char) = { \
322
#define DRIZZLE_THDVAR_BOOL(name, opt, comment, check, update, def) \
323
DECLARE_DRIZZLE_THDVAR_BASIC(name, char) = { \
324
324
PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
325
325
#name, comment, check, update, -1, def, NULL}
327
#define MYSQL_THDVAR_STR(name, opt, comment, check, update, def) \
328
DECLARE_MYSQL_THDVAR_BASIC(name, char *) = { \
327
#define DRIZZLE_THDVAR_STR(name, opt, comment, check, update, def) \
328
DECLARE_DRIZZLE_THDVAR_BASIC(name, char *) = { \
329
329
PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
330
330
#name, comment, check, update, -1, def, NULL}
332
#define MYSQL_THDVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
333
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) = { \
334
334
PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
335
335
#name, comment, check, update, -1, def, min, max, blk, NULL }
337
#define MYSQL_THDVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
338
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) = { \
339
339
PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
340
340
#name, comment, check, update, -1, def, min, max, blk, NULL }
342
#define MYSQL_THDVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
343
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) = { \
344
344
PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
345
345
#name, comment, check, update, -1, def, min, max, blk, NULL }
347
#define MYSQL_THDVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
348
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) = { \
349
349
PLUGIN_VAR_LONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
350
350
#name, comment, check, update, -1, def, min, max, blk, NULL }
352
#define MYSQL_THDVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
353
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) = { \
354
354
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
355
355
#name, comment, check, update, -1, def, min, max, blk, NULL }
357
#define MYSQL_THDVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
358
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) = { \
359
359
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
360
360
#name, comment, check, update, -1, def, min, max, blk, NULL }
362
#define MYSQL_THDVAR_ENUM(name, opt, comment, check, update, def, typelib) \
363
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) = { \
364
364
PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
365
365
#name, comment, check, update, -1, def, NULL, typelib }
367
#define MYSQL_THDVAR_SET(name, opt, comment, check, update, def, typelib) \
368
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) = { \
369
369
PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
370
370
#name, comment, check, update, -1, def, NULL, typelib }
372
372
/* accessor macros */
374
374
#define SYSVAR(name) \
375
(*(MYSQL_SYSVAR_NAME(name).value))
375
(*(DRIZZLE_SYSVAR_NAME(name).value))
377
377
/* when thd == null, result points to global value */
378
378
#define THDVAR(thd, name) \
379
(*(MYSQL_SYSVAR_NAME(name).resolve(thd, MYSQL_SYSVAR_NAME(name).offset)))
379
(*(DRIZZLE_SYSVAR_NAME(name).resolve(thd, DRIZZLE_SYSVAR_NAME(name).offset)))