20
20
#ifndef DRIZZLED_PLUGIN_H
21
21
#define DRIZZLED_PLUGIN_H
23
#include <drizzled/lex_string.h>
24
#include <drizzled/xid.h>
25
#include <drizzled/plugin/manifest.h>
26
#include <drizzled/plugin/module.h>
23
#include "drizzled/module/manifest.h"
24
#include "drizzled/module/module.h"
27
25
#include "drizzled/plugin/version.h"
26
#include "drizzled/module/context.h"
28
27
#include "drizzled/definitions.h"
29
#include "drizzled/plugin/context.h"
29
#include "drizzled/lex_string.h"
30
#include "drizzled/xid.h"
31
#include <boost/program_options.hpp>
45
46
typedef drizzle_lex_string LEX_STRING;
48
extern char *opt_plugin_add;
49
extern char *opt_plugin_remove;
50
extern char *opt_plugin_load;
51
extern char *opt_plugin_dir_ptr;
52
49
extern char opt_plugin_dir[FN_REFLEN];
54
51
namespace plugin { class StorageEngine; }
57
54
Macros for beginning and ending plugin declarations. Between
58
55
DRIZZLE_DECLARE_PLUGIN and DRIZZLE_DECLARE_PLUGIN_END there should
59
be a plugin::Manifest for each plugin to be declared.
56
be a module::Manifest for each plugin to be declared.
63
60
#define PANDORA_CPP_NAME(x) _drizzled_ ## x ## _plugin_
64
61
#define PANDORA_PLUGIN_NAME(x) PANDORA_CPP_NAME(x)
65
62
#define DRIZZLE_DECLARE_PLUGIN \
66
::drizzled::plugin::Manifest PANDORA_PLUGIN_NAME(PANDORA_MODULE_NAME)=
63
::drizzled::module::Manifest PANDORA_PLUGIN_NAME(PANDORA_MODULE_NAME)=
69
66
#define DRIZZLE_DECLARE_PLUGIN_END
70
#define DRIZZLE_PLUGIN(init,system) \
67
#define DRIZZLE_PLUGIN(init,system,options) \
71
68
DRIZZLE_DECLARE_PLUGIN \
73
70
DRIZZLE_VERSION_ID, \
76
73
STRINGIFY_ARG(PANDORA_MODULE_AUTHOR), \
77
74
STRINGIFY_ARG(PANDORA_MODULE_TITLE), \
78
75
PANDORA_MODULE_LICENSE, \
76
init, system, options \
88
85
SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG,
89
86
SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
90
SHOW_FUNC, SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_LONGLONG,
91
88
SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS,
92
89
SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, SHOW_INT_NOFLUSH,
93
90
SHOW_LONGLONG_STATUS, SHOW_DOUBLE, SHOW_SIZE
188
185
mysql_var_check_func check; \
189
186
mysql_var_update_func update
191
#define DRIZZLE_SYSVAR_NAME(name) mysql_sysvar_ ## name
188
#define DRIZZLE_SYSVAR_NAME(name) drizzle_sysvar_ ## name
192
189
#define DRIZZLE_SYSVAR(name) \
193
190
((drizzle_sys_var *)(&(DRIZZLE_SYSVAR_NAME(name))))
371
368
Miscellaneous functions for plugin implementors
378
extern bool plugin_init(plugin::Registry ®istry,
379
int *argc, char **argv,
381
extern void plugin_shutdown(plugin::Registry &plugins);
371
extern bool plugin_init(module::Registry ®istry,
372
boost::program_options::options_description &long_options);
373
extern bool plugin_finalize(module::Registry ®istry);
382
374
extern void my_print_help_inc_plugins(option *options);
383
375
extern bool plugin_is_ready(const LEX_STRING *name, int type);
384
376
extern void plugin_sessionvar_init(Session *session);
391
383
const char *get_session_proc_info(Session *session);
392
384
int64_t session_test_options(const Session *session, int64_t test_options);
393
385
int session_sql_command(const Session *session);
394
int session_tx_isolation(const Session *session);
386
enum_tx_isolation session_tx_isolation(const Session *session);
388
void compose_plugin_add(std::vector<std::string> options);
389
void compose_plugin_remove(std::vector<std::string> options);
390
void notify_plugin_load(std::string in_plugin_load);
426
421
int session_killed(const Session *session);
430
Return the thread id of a user thread
432
@param session user thread connection handle
435
unsigned long session_get_thread_id(const Session *session);
437
424
const charset_info_st *session_charset(Session *session);
438
int session_non_transactional_update(const Session *session);
439
void session_mark_transaction_to_rollback(Session *session, bool all);
443
Allocate memory in the connection's local memory pool
446
When properly used in place of @c malloc(), this can significantly
447
improve concurrency. Don't use this or related functions to allocate
448
large chunks of memory. Use for temporary storage only. The memory
449
will be freed automatically at the end of the statement; no explicit
450
code is required to prevent memory leaks.
454
void *session_alloc(Session *session, unsigned int size);
458
void *session_calloc(Session *session, unsigned int size);
462
char *session_strdup(Session *session, const char *str);
466
char *session_strmake(Session *session, const char *str, unsigned int size);
470
void *session_memdup(Session *session, const void* str, unsigned int size);
473
Get the XID for this connection's transaction
475
@param session user thread connection handle
476
@param xid location where identifier is stored
478
void session_get_xid(const Session *session, DRIZZLE_XID *xid);
481
427
Invalidate the query cache for a given table.