~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin.h

Remove PLUGIN and MODULES.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <drizzled/lex_string.h>
24
24
#include <drizzled/xid.h>
25
25
#include <drizzled/plugin/manifest.h>
26
 
#include <drizzled/plugin/library.h>
27
26
#include <drizzled/plugin/module.h>
 
27
#include "drizzled/plugin/version.h"
 
28
#include "drizzled/definitions.h"
 
29
 
28
30
 
29
31
class Session;
30
32
class Item;
36
38
 
37
39
 
38
40
class sys_var;
39
 
typedef struct st_mysql_lex_string LEX_STRING;
 
41
typedef drizzle_lex_string LEX_STRING;
40
42
struct my_option;
41
43
 
42
44
extern char *opt_plugin_add;
48
50
 
49
51
/*
50
52
  Macros for beginning and ending plugin declarations. Between
51
 
  drizzle_declare_plugin and drizzle_declare_plugin_end there should
 
53
  DRIZZLE_DECLARE_PLUGIN and DRIZZLE_DECLARE_PLUGIN_END there should
52
54
  be a drizzled::plugin::Manifest for each plugin to be declared.
53
55
*/
54
56
 
55
57
 
56
 
#if defined(PANDORA_DYNAMIC_PLUGIN)
57
 
# define drizzle_declare_plugin \
58
 
    drizzled::plugin::Manifest _drizzled_plugin_declaration_[]= {
59
 
#else
60
 
# define PANDORA_BUILTIN_NAME(x) builtin_ ## x ## _plugin
61
 
# define PANDORA_NAME(x) PANDORA_BUILTIN_NAME(x)
62
 
# define drizzle_declare_plugin \
63
 
           drizzled::plugin::Manifest PANDORA_NAME(PANDORA_MODULE_NAME)[]= {
64
 
#endif
65
 
 
66
 
 
67
 
#define drizzle_declare_plugin_end ,{0,0,0,0,PLUGIN_LICENSE_GPL,0,0,0,0,0}}
68
 
 
69
 
 
70
 
 
71
 
/*
72
 
  the following flags are valid for plugin_init()
73
 
*/
74
 
#define PLUGIN_INIT_SKIP_DYNAMIC_LOADING 1
75
 
#define PLUGIN_INIT_SKIP_PLUGIN_TABLE    2
76
 
#define PLUGIN_INIT_SKIP_INITIALIZATION  4
77
 
 
78
 
#define INITIAL_LEX_PLUGIN_LIST_SIZE    16
 
58
#define PANDORA_CPP_NAME(x) _drizzled_ ## x ## _plugin_
 
59
#define PANDORA_PLUGIN_NAME(x) PANDORA_CPP_NAME(x)
 
60
#define DRIZZLE_DECLARE_PLUGIN \
 
61
           drizzled::plugin::Manifest PANDORA_PLUGIN_NAME(PANDORA_MODULE_NAME)= 
 
62
 
 
63
 
 
64
#define DRIZZLE_DECLARE_PLUGIN_END
 
65
#define DRIZZLE_PLUGIN(init,deinit,status,system) \
 
66
  DRIZZLE_DECLARE_PLUGIN \
 
67
  { \
 
68
    DRIZZLE_VERSION_ID, \
 
69
    STRINGIFY_ARG(PANDORA_MODULE_NAME), \
 
70
    STRINGIFY_ARG(PANDORA_MODULE_VERSION), \
 
71
    STRINGIFY_ARG(PANDORA_MODULE_AUTHOR), \
 
72
    STRINGIFY_ARG(PANDORA_MODULE_TITLE), \
 
73
    PANDORA_MODULE_LICENSE, \
 
74
    init, deinit, status, system, NULL \
 
75
  } 
 
76
 
79
77
 
80
78
/*
81
79
  declarations for SHOW STATUS support in plugins
90
88
  SHOW_LONGLONG_STATUS, SHOW_DOUBLE, SHOW_SIZE
91
89
};
92
90
 
93
 
struct st_mysql_show_var {
 
91
struct drizzle_show_var {
94
92
  const char *name;
95
93
  char *value;
96
94
  enum enum_mysql_show_type type;
97
95
};
98
96
 
99
97
typedef enum enum_mysql_show_type SHOW_TYPE;
100
 
typedef struct st_mysql_show_var SHOW_VAR;
 
98
typedef drizzle_show_var SHOW_VAR;
101
99
 
102
100
 
103
101
#define SHOW_VAR_FUNC_BUFF_SIZE 1024
104
 
typedef int (*mysql_show_var_func)(struct st_mysql_show_var *, char *);
 
102
typedef int (*mysql_show_var_func)(drizzle_show_var *, char *);
105
103
 
106
104
struct st_show_var_func_container {
107
105
  mysql_show_var_func func;
128
126
#define PLUGIN_VAR_OPCMDARG     0x2000 /* Argument optional for cmd line */
129
127
#define PLUGIN_VAR_MEMALLOC     0x8000 /* String needs memory allocated */
130
128
 
131
 
struct st_mysql_sys_var;
132
 
struct st_mysql_value;
 
129
struct drizzle_sys_var;
 
130
struct drizzle_value;
133
131
 
134
132
/*
135
133
  SYNOPSIS
151
149
*/
152
150
 
153
151
typedef int (*mysql_var_check_func)(Session *session,
154
 
                                    struct st_mysql_sys_var *var,
155
 
                                    void *save, struct st_mysql_value *value);
 
152
                                    drizzle_sys_var *var,
 
153
                                    void *save, drizzle_value *value);
156
154
 
157
155
/*
158
156
  SYNOPSIS
169
167
   For example, strings may require memory to be allocated.
170
168
*/
171
169
typedef void (*mysql_var_update_func)(Session *session,
172
 
                                      struct st_mysql_sys_var *var,
 
170
                                      drizzle_sys_var *var,
173
171
                                      void *var_ptr, const void *save);
174
172
 
175
173
 
190
188
 
191
189
#define DRIZZLE_SYSVAR_NAME(name) mysql_sysvar_ ## name
192
190
#define DRIZZLE_SYSVAR(name) \
193
 
  ((struct st_mysql_sys_var *)&(DRIZZLE_SYSVAR_NAME(name)))
 
191
  ((drizzle_sys_var *)(&(DRIZZLE_SYSVAR_NAME(name))))
194
192
 
195
193
/*
196
194
  for global variables, the value pointer is the first
361
359
 
362
360
 
363
361
/*************************************************************************
364
 
  st_mysql_value struct for reading values from mysqld.
 
362
  drizzle_value struct for reading values from mysqld.
365
363
  Used by server variables framework to parse user-provided values.
366
364
  Will be used for arguments when implementing UDFs.
367
365
 
374
372
#define DRIZZLE_VALUE_TYPE_REAL   1
375
373
#define DRIZZLE_VALUE_TYPE_INT    2
376
374
 
377
 
struct st_mysql_value
378
 
{
379
 
  int (*value_type)(struct st_mysql_value *);
380
 
  const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
381
 
  int (*val_real)(struct st_mysql_value *, double *realbuf);
382
 
  int (*val_int)(struct st_mysql_value *, int64_t *intbuf);
 
375
/*
 
376
  skeleton of a plugin variable - portion of structure common to all.
 
377
*/
 
378
struct drizzle_sys_var
 
379
{
 
380
  DRIZZLE_PLUGIN_VAR_HEADER;
 
381
};
 
382
 
 
383
void plugin_opt_set_limits(my_option *options, const drizzle_sys_var *opt);
 
384
 
 
385
struct drizzle_value
 
386
{
 
387
  int (*value_type)(drizzle_value *);
 
388
  const char *(*val_str)(drizzle_value *, char *buffer, int *length);
 
389
  int (*val_real)(drizzle_value *, double *realbuf);
 
390
  int (*val_int)(drizzle_value *, int64_t *intbuf);
383
391
};
384
392
 
385
393
 
391
399
extern "C" {
392
400
#endif
393
401
 
394
 
extern int plugin_init(drizzled::plugin::Registry &plugins,
395
 
                       int *argc, char **argv, int init_flags);
 
402
extern bool plugin_init(drizzled::plugin::Registry &registry,
 
403
                        int *argc, char **argv,
 
404
                        bool skip_init);
396
405
extern void plugin_shutdown(drizzled::plugin::Registry &plugins);
397
406
extern void my_print_help_inc_plugins(my_option *options);
398
407
extern bool plugin_is_ready(const LEX_STRING *name, int type);
399
 
extern bool mysql_install_plugin(Session *session, const LEX_STRING *name,
400
 
                                 const LEX_STRING *dl);
401
 
extern bool mysql_uninstall_plugin(Session *session, const LEX_STRING *name);
402
408
extern void plugin_sessionvar_init(Session *session);
403
409
extern void plugin_sessionvar_cleanup(Session *session);
404
410
extern sys_var *intern_find_sys_var(const char *str, uint32_t, bool no_error);
409
415
const char *get_session_proc_info(Session *session);
410
416
int64_t session_test_options(const Session *session, int64_t test_options);
411
417
int session_sql_command(const Session *session);
412
 
void **session_ha_data(const Session *session, const drizzled::plugin::StorageEngine *engine);
413
418
int session_tx_isolation(const Session *session);
414
419
 
415
 
LEX_STRING *session_make_lex_string(Session *session, LEX_STRING *lex_str,
416
 
                                    const char *str, unsigned int size,
417
 
                                    int allocate_lex_string);
418
 
 
419
420
 
420
421
 
421
422
/**
517
518
}
518
519
#endif
519
520
 
520
 
#ifdef __cplusplus
521
 
/**
522
 
  Provide a handler data getter to simplify coding
523
 
*/
524
 
inline
525
 
void *
526
 
session_get_ha_data(const Session *session, const drizzled::plugin::StorageEngine *engine)
527
 
{
528
 
  return *session_ha_data(session, engine);
529
 
}
530
 
 
531
 
/**
532
 
  Provide a handler data setter to simplify coding
533
 
*/
534
 
inline
535
 
void
536
 
session_set_ha_data(const Session *session, const drizzled::plugin::StorageEngine *engine,
537
 
                const void *ha_data)
538
 
{
539
 
  *session_ha_data(session, engine)= (void*) ha_data;
540
 
}
541
 
#endif
542
 
 
543
521
#endif /* DRIZZLED_PLUGIN_H */
544
522