27
27
* THE POSSIBILITY OF SUCH DAMAGE.
31
#include <drizzled/show.h>
32
#include <drizzled/gettext.h>
33
#include <boost/program_options.hpp>
34
#include <drizzled/module/option_map.h>
31
#include "drizzled/show.h"
32
#include "drizzled/gettext.h"
35
34
#include "stats_table.h"
36
35
#include "analysis_table.h"
37
36
#include "sysvar_holder.h"
63
59
* @param[in] registry the drizzled::plugin::Registry singleton
64
60
* @return false on success; true on failure.
66
static int init(drizzled::module::Context &context)
62
static int init(module::Context &context)
68
const drizzled::module::option_map &vm= context.getOptions();
65
SysvarHolder &sysvar_holder= SysvarHolder::singleton();
66
sysvar_holder.setServersString(sysvar_memcached_servers);
70
68
/* we are good to go */
71
stats_table_tool= new StatsTableTool;
69
stats_table_tool= new(std::nothrow)StatsTableTool;
72
70
context.add(stats_table_tool);
74
analysis_table_tool= new AnalysisTableTool;
72
analysis_table_tool= new(std::nothrow)AnalysisTableTool;
75
73
context.add(analysis_table_tool);
77
context.registerVariable(new sys_var_std_string("servers",
78
sysvar_memcached_servers));
83
static void init_options(drizzled::module::option_context &context)
86
po::value<std::string>()->default_value(""),
87
_("List of memcached servers."));
90
} /* namespace drizzle_plugin */
78
static int check_memc_servers(Session *,
83
char buff[STRING_BUFFER_USUAL_SIZE];
84
int len= sizeof(buff);
85
const char *input= value->val_str(value, buff, &len);
89
SysvarHolder &sysvar_holder= SysvarHolder::singleton();
90
sysvar_holder.setServersStringVar(input);
91
*(bool *) save= (bool) true;
95
*(bool *) save= (bool) false;
99
static void set_memc_servers(Session *,
104
if (*(bool *) save != false)
106
SysvarHolder &sysvar_holder= SysvarHolder::singleton();
107
sysvar_holder.updateServersSysvar((const char **) var_ptr);
111
static DRIZZLE_SYSVAR_STR(servers,
112
sysvar_memcached_servers,
114
N_("List of memcached servers."),
115
check_memc_servers, /* check func */
116
set_memc_servers, /* update func */
117
""); /* default value */
119
static drizzle_sys_var *system_variables[]=
121
DRIZZLE_SYSVAR(servers),
92
125
DRIZZLE_DECLARE_PLUGIN
97
130
"Padraig O'Sullivan",
98
131
N_("Memcached Stats as I_S tables"),
99
132
PLUGIN_LICENSE_BSD,
100
drizzle_plugin::init, /* Plugin Init */
102
drizzle_plugin::init_options /* config options */
133
init, /* Plugin Init */
134
system_variables, /* system variables */
135
NULL /* config options */
104
137
DRIZZLE_DECLARE_PLUGIN_END;