~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/memcached_stats/stats_table.cc

  • Committer: Monty Taylor
  • Date: 2010-12-06 21:17:06 UTC
  • mto: (1977.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1980.
  • Revision ID: mordred@inaugust.com-20101206211706-iiuzzkxhh3fm10zf
Add ability to add a validation function to any sys_var. duh.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include "config.h"
31
31
 
32
32
#include "stats_table.h"
33
 
#include "sysvar_holder.h"
34
33
 
35
34
#include "drizzled/error.h"
36
35
#include <libmemcached/server.h>
37
36
 
38
 
using namespace std;
39
 
using namespace drizzled;
40
 
 
41
37
#if !defined(HAVE_MEMCACHED_SERVER_FN)
42
38
typedef memcached_server_function memcached_server_fn;
43
39
#endif
44
40
 
 
41
namespace drizzle_plugin
 
42
{
 
43
 
45
44
extern "C"
46
45
memcached_return  server_function(const memcached_st *ptr,
47
46
                                  memcached_server_st *server,
48
47
                                  void *context);
49
48
 
50
 
 
51
49
struct server_function_context
52
50
{
53
51
  StatsTableTool::Generator* generator; 
125
123
}
126
124
 
127
125
 
128
 
StatsTableTool::Generator::Generator(Field **arg) :
 
126
StatsTableTool::Generator::Generator(drizzled::Field **arg) :
129
127
  plugin::TableFunction::Generator(arg)
130
128
{
131
129
  /* This will be set to the real number if we initialize properly below */
136
134
  /* set to NULL if we are not able to init we dont want to call delete on this */
137
135
  memc= NULL;
138
136
 
139
 
  SysvarHolder &sysvar_holder= SysvarHolder::singleton();
140
 
  const string servers_string= sysvar_holder.getServersString();
 
137
  drizzled::sys_var *servers_var= drizzled::find_sys_var("memcached_stats_servers");
 
138
  assert(servers_var != NULL);
 
139
 
 
140
  const string servers_string(static_cast<char *>(servers_var.value_ptr(NULL, 0, NULL)));
141
141
 
142
142
  if (servers_string.empty())
143
143
  {
200
200
 
201
201
  return true;
202
202
}
 
203
 
 
204
} /* namespace drizzle_plugin */