~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/memcached_stats/stats_table.cc

  • Committer: Brian Aker
  • Date: 2010-11-06 22:20:39 UTC
  • mto: This revision was merged to the branch mainline in revision 1910.
  • Revision ID: brian@tangent.org-20101106222039-svjhoxtkw766w1bp
Additional io_cache encapsulation.

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