145
171
void *var_ptr, const void *save);
174
/* the following declarations are for internal use only */
177
#define PLUGIN_VAR_MASK \
178
(PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | \
179
PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \
180
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC)
182
#define DRIZZLE_PLUGIN_VAR_HEADER \
185
const char *comment; \
186
mysql_var_check_func check; \
187
mysql_var_update_func update
189
#define DRIZZLE_SYSVAR_NAME(name) drizzle_sysvar_ ## name
190
#define DRIZZLE_SYSVAR(name) \
191
((drizzle_sys_var *)(&(DRIZZLE_SYSVAR_NAME(name))))
194
for global variables, the value pointer is the first
195
element after the header, the default value is the second.
196
for thread variables, the value offset is the first
197
element after the header, the default value is the second.
201
#define DECLARE_DRIZZLE_SYSVAR_BOOL(name) struct { \
202
DRIZZLE_PLUGIN_VAR_HEADER; \
205
} DRIZZLE_SYSVAR_NAME(name)
207
#define DECLARE_DRIZZLE_SYSVAR_BASIC(name, type) struct { \
208
DRIZZLE_PLUGIN_VAR_HEADER; \
210
const type def_val; \
211
} DRIZZLE_SYSVAR_NAME(name)
213
#define DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, type) struct { \
214
DRIZZLE_PLUGIN_VAR_HEADER; \
215
type *value; type def_val; \
216
type min_val; type max_val; \
218
} DRIZZLE_SYSVAR_NAME(name)
220
#define DECLARE_SessionVAR_FUNC(type) \
221
type *(*resolve)(Session *session, int offset)
223
#define DECLARE_DRIZZLE_SessionVAR_BASIC(name, type) struct { \
224
DRIZZLE_PLUGIN_VAR_HEADER; \
226
const type def_val; \
227
DECLARE_SessionVAR_FUNC(type); \
228
} DRIZZLE_SYSVAR_NAME(name)
230
#define DECLARE_DRIZZLE_SessionVAR_BOOL(name) struct { \
231
DRIZZLE_PLUGIN_VAR_HEADER; \
234
DECLARE_SessionVAR_FUNC(bool); \
235
} DRIZZLE_SYSVAR_NAME(name)
237
#define DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, type) struct { \
238
DRIZZLE_PLUGIN_VAR_HEADER; \
240
type def_val; type min_val; \
241
type max_val; type blk_sz; \
242
DECLARE_SessionVAR_FUNC(type); \
243
} DRIZZLE_SYSVAR_NAME(name)
245
#define DECLARE_DRIZZLE_SessionVAR_TYPELIB(name, type) struct { \
246
DRIZZLE_PLUGIN_VAR_HEADER; \
249
DECLARE_SessionVAR_FUNC(type); \
251
} DRIZZLE_SYSVAR_NAME(name)
255
the following declarations are for use by plugin implementors
258
#define DECLARE_DRIZZLE_SYSVAR_BOOL(name) struct { \
259
DRIZZLE_PLUGIN_VAR_HEADER; \
262
} DRIZZLE_SYSVAR_NAME(name)
265
#define DRIZZLE_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
266
DECLARE_DRIZZLE_SYSVAR_BOOL(name) = { \
267
PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \
268
#name, comment, check, update, &varname, def}
270
#define DECLARE_DRIZZLE_SYSVAR_BASIC(name, type) struct { \
271
DRIZZLE_PLUGIN_VAR_HEADER; \
273
const type def_val; \
274
} DRIZZLE_SYSVAR_NAME(name)
276
#define DRIZZLE_SYSVAR_STR(name, varname, opt, comment, check, update, def) \
277
DECLARE_DRIZZLE_SYSVAR_BASIC(name, char *) = { \
278
PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \
279
#name, comment, check, update, &varname, def}
281
#define DRIZZLE_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \
282
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, int) = { \
283
PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \
284
#name, comment, check, update, &varname, def, min, max, blk }
286
#define DRIZZLE_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \
287
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, unsigned int) = { \
288
PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
289
#name, comment, check, update, &varname, def, min, max, blk }
291
#define DRIZZLE_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \
292
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, long) = { \
293
PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \
294
#name, comment, check, update, &varname, def, min, max, blk }
296
#define DRIZZLE_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \
297
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, unsigned long) = { \
298
PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
299
#name, comment, check, update, &varname, def, min, max, blk }
301
#define DRIZZLE_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
302
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, int64_t) = { \
303
PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \
304
#name, comment, check, update, &varname, def, min, max, blk }
306
#define DRIZZLE_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
307
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, uint64_t) = { \
308
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
309
#name, comment, check, update, &varname, def, min, max, blk }
311
#define DRIZZLE_SessionVAR_BOOL(name, opt, comment, check, update, def) \
312
DECLARE_DRIZZLE_SessionVAR_BOOL(name) = { \
313
PLUGIN_VAR_BOOL | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
314
#name, comment, check, update, -1, def, NULL}
316
#define DRIZZLE_SessionVAR_STR(name, opt, comment, check, update, def) \
317
DECLARE_DRIZZLE_SessionVAR_BASIC(name, char *) = { \
318
PLUGIN_VAR_STR | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
319
#name, comment, check, update, -1, def, NULL}
321
#define DRIZZLE_SessionVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
322
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, int) = { \
323
PLUGIN_VAR_INT | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
324
#name, comment, check, update, -1, def, min, max, blk, NULL }
326
#define DRIZZLE_SessionVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
327
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, unsigned int) = { \
328
PLUGIN_VAR_INT | PLUGIN_VAR_SessionLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
329
#name, comment, check, update, -1, def, min, max, blk, NULL }
331
#define DRIZZLE_SessionVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
332
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, long) = { \
333
PLUGIN_VAR_LONG | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
334
#name, comment, check, update, -1, def, min, max, blk, NULL }
336
#define DRIZZLE_SessionVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
337
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, unsigned long) = { \
338
PLUGIN_VAR_LONG | PLUGIN_VAR_SessionLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
339
#name, comment, check, update, -1, def, min, max, blk, NULL }
341
#define DRIZZLE_SessionVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
342
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, int64_t) = { \
343
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
344
#name, comment, check, update, -1, def, min, max, blk, NULL }
346
#define DRIZZLE_SessionVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
347
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, uint64_t) = { \
348
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_SessionLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
349
#name, comment, check, update, -1, def, min, max, blk, NULL }
351
/* accessor macros */
353
#define SYSVAR(name) \
354
(*(DRIZZLE_SYSVAR_NAME(name).value))
356
/* when session == null, result points to global value */
357
#define SessionVAR(session, name) \
358
(*(DRIZZLE_SYSVAR_NAME(name).resolve(session, DRIZZLE_SYSVAR_NAME(name).offset)))
361
/*************************************************************************
362
drizzle_value struct for reading values from mysqld.
363
Used by server variables framework to parse user-provided values.
364
Will be used for arguments when implementing UDFs.
366
Note that val_str() returns a string in temporary memory
367
that will be freed at the end of statement. Copy the string
368
if you need it to persist.
371
#define DRIZZLE_VALUE_TYPE_STRING 0
372
#define DRIZZLE_VALUE_TYPE_REAL 1
373
#define DRIZZLE_VALUE_TYPE_INT 2
150
376
skeleton of a plugin variable - portion of structure common to all.
152
378
struct drizzle_sys_var
380
DRIZZLE_PLUGIN_VAR_HEADER;
156
383
void plugin_opt_set_limits(option *options, const drizzle_sys_var *opt);