~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin.h

  • Committer: Stewart Smith
  • Date: 2010-01-09 00:51:36 UTC
  • mto: This revision was merged to the branch mainline in revision 1266.
  • Revision ID: stewart@flamingspork.com-20100109005136-ocj7l996l709oaev
remove mention of getting information from FRM files for INFORMATION_SCHEMA. The comment was now pretty much all lies anyway

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include <drizzled/plugin/module.h>
27
27
#include "drizzled/plugin/version.h"
28
28
#include "drizzled/definitions.h"
29
 
#include "drizzled/plugin/context.h"
30
 
 
31
 
 
32
 
namespace drizzled
33
 
{
 
29
 
34
30
 
35
31
class Session;
36
32
class Item;
43
39
 
44
40
class sys_var;
45
41
typedef drizzle_lex_string LEX_STRING;
46
 
struct option;
 
42
struct my_option;
47
43
 
48
44
extern char *opt_plugin_add;
49
 
extern char *opt_plugin_remove;
50
45
extern char *opt_plugin_load;
51
46
extern char *opt_plugin_dir_ptr;
52
47
extern char opt_plugin_dir[FN_REFLEN];
53
48
 
54
 
namespace plugin { class StorageEngine; }
 
49
namespace drizzled { namespace plugin { class StorageEngine; } }
55
50
 
56
51
/*
57
52
  Macros for beginning and ending plugin declarations. Between
58
53
  DRIZZLE_DECLARE_PLUGIN and DRIZZLE_DECLARE_PLUGIN_END there should
59
 
  be a plugin::Manifest for each plugin to be declared.
 
54
  be a drizzled::plugin::Manifest for each plugin to be declared.
60
55
*/
61
56
 
62
57
 
63
58
#define PANDORA_CPP_NAME(x) _drizzled_ ## x ## _plugin_
64
59
#define PANDORA_PLUGIN_NAME(x) PANDORA_CPP_NAME(x)
65
60
#define DRIZZLE_DECLARE_PLUGIN \
66
 
  ::drizzled::plugin::Manifest PANDORA_PLUGIN_NAME(PANDORA_MODULE_NAME)= 
 
61
           drizzled::plugin::Manifest PANDORA_PLUGIN_NAME(PANDORA_MODULE_NAME)= 
67
62
 
68
63
 
69
64
#define DRIZZLE_DECLARE_PLUGIN_END
70
 
#define DRIZZLE_PLUGIN(init,system) \
 
65
#define DRIZZLE_PLUGIN(init,deinit,status,system) \
71
66
  DRIZZLE_DECLARE_PLUGIN \
72
67
  { \
73
68
    DRIZZLE_VERSION_ID, \
76
71
    STRINGIFY_ARG(PANDORA_MODULE_AUTHOR), \
77
72
    STRINGIFY_ARG(PANDORA_MODULE_TITLE), \
78
73
    PANDORA_MODULE_LICENSE, \
79
 
    init, system, NULL \
 
74
    init, deinit, status, system, NULL \
80
75
  } 
81
76
 
82
77
 
87
82
{
88
83
  SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG,
89
84
  SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
90
 
  SHOW_FUNC, SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_LONGLONG,
91
 
  SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS,
 
85
  SHOW_ARRAY, SHOW_FUNC, SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_LONGLONG,
 
86
  SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, SHOW_HAVE, 
92
87
  SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, SHOW_INT_NOFLUSH,
93
88
  SHOW_LONGLONG_STATUS, SHOW_DOUBLE, SHOW_SIZE
94
89
};
100
95
};
101
96
 
102
97
typedef enum enum_mysql_show_type SHOW_TYPE;
 
98
typedef drizzle_show_var SHOW_VAR;
103
99
 
104
100
 
105
101
#define SHOW_VAR_FUNC_BUFF_SIZE 1024
118
114
#define PLUGIN_VAR_LONG         0x0003
119
115
#define PLUGIN_VAR_LONGLONG     0x0004
120
116
#define PLUGIN_VAR_STR          0x0005
 
117
#define PLUGIN_VAR_ENUM         0x0006
 
118
#define PLUGIN_VAR_SET          0x0007
121
119
#define PLUGIN_VAR_UNSIGNED     0x0080
122
120
#define PLUGIN_VAR_SessionLOCAL     0x0100 /* Variable is per-connection */
123
121
#define PLUGIN_VAR_READONLY     0x0200 /* Server variable is read only */
213
211
  type blk_sz;                  \
214
212
} DRIZZLE_SYSVAR_NAME(name)
215
213
 
 
214
#define DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, type) struct { \
 
215
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
216
  type *value; type def_val;    \
 
217
  TYPELIB *typelib;             \
 
218
} DRIZZLE_SYSVAR_NAME(name)
 
219
 
216
220
#define DECLARE_SessionVAR_FUNC(type) \
217
221
  type *(*resolve)(Session *session, int offset)
218
222
 
284
288
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
285
289
  #name, comment, check, update, &varname, def, min, max, blk }
286
290
 
 
291
#define DRIZZLE_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
 
292
DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, unsigned long) = { \
 
293
  PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \
 
294
  #name, comment, check, update, &varname, def, typelib }
 
295
 
 
296
#define DRIZZLE_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \
 
297
DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, uint64_t) = { \
 
298
  PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \
 
299
  #name, comment, check, update, &varname, def, typelib }
 
300
 
287
301
#define DRIZZLE_SessionVAR_BOOL(name, opt, comment, check, update, def) \
288
302
DECLARE_DRIZZLE_SessionVAR_BASIC(name, char) = { \
289
303
  PLUGIN_VAR_BOOL | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
324
338
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_SessionLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
325
339
  #name, comment, check, update, -1, def, min, max, blk, NULL }
326
340
 
 
341
#define DRIZZLE_SessionVAR_ENUM(name, opt, comment, check, update, def, typelib) \
 
342
DECLARE_DRIZZLE_SessionVAR_TYPELIB(name, unsigned long) = { \
 
343
  PLUGIN_VAR_ENUM | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
 
344
  #name, comment, check, update, -1, def, NULL, typelib }
 
345
 
 
346
#define DRIZZLE_SessionVAR_SET(name, opt, comment, check, update, def, typelib) \
 
347
DECLARE_DRIZZLE_SessionVAR_TYPELIB(name, uint64_t) = { \
 
348
  PLUGIN_VAR_SET | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
 
349
  #name, comment, check, update, -1, def, NULL, typelib }
 
350
 
327
351
/* accessor macros */
328
352
 
329
353
#define SYSVAR(name) \
348
372
#define DRIZZLE_VALUE_TYPE_REAL   1
349
373
#define DRIZZLE_VALUE_TYPE_INT    2
350
374
 
351
 
/*
352
 
  skeleton of a plugin variable - portion of structure common to all.
353
 
*/
354
 
struct drizzle_sys_var
355
 
{
356
 
  DRIZZLE_PLUGIN_VAR_HEADER;
357
 
};
358
 
 
359
 
void plugin_opt_set_limits(option *options, const drizzle_sys_var *opt);
360
 
 
361
375
struct drizzle_value
362
376
{
363
377
  int (*value_type)(drizzle_value *);
375
389
extern "C" {
376
390
#endif
377
391
 
378
 
extern bool plugin_init(plugin::Registry &registry,
 
392
extern bool plugin_init(drizzled::plugin::Registry &registry,
379
393
                        int *argc, char **argv,
380
394
                        bool skip_init);
381
 
extern void plugin_shutdown(plugin::Registry &plugins);
382
 
extern void my_print_help_inc_plugins(option *options);
 
395
extern void plugin_shutdown(drizzled::plugin::Registry &plugins);
 
396
extern void my_print_help_inc_plugins(my_option *options);
383
397
extern bool plugin_is_ready(const LEX_STRING *name, int type);
384
398
extern void plugin_sessionvar_init(Session *session);
385
399
extern void plugin_sessionvar_cleanup(Session *session);
405
419
 
406
420
  @param prefix  prefix for temporary file name
407
421
  @retval -1    error
408
 
  @retval >= 0  a file handle that can be passed to dup or internal::my_close
 
422
  @retval >= 0  a file handle that can be passed to dup or my_close
409
423
*/
410
424
int mysql_tmpfile(const char *prefix);
411
425
 
435
449
unsigned long session_get_thread_id(const Session *session);
436
450
 
437
451
const charset_info_st *session_charset(Session *session);
 
452
char **session_query(Session *session);
438
453
int session_non_transactional_update(const Session *session);
439
454
void session_mark_transaction_to_rollback(Session *session, bool all);
440
455
 
493
508
}
494
509
#endif
495
510
 
496
 
} /* namespace drizzled */
497
 
 
498
511
#endif /* DRIZZLED_PLUGIN_H */
499
512