~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-08-09 18:04:12 UTC
  • mfrom: (1689.3.7 staging)
  • Revision ID: brian@gaz-20100809180412-olurwh51ojllev6p
Merge in heap conversion, and case insensitive patch, and remove need for
M_HASH in session.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2009, Padraig O'Sullivan
 
2
 * Copyright (c) 2009, Padraig O'Sullivan
3
3
 * All rights reserved.
4
4
 *
5
5
 * Redistribution and use in source and binary forms, with or without
27
27
 * THE POSSIBILITY OF SUCH DAMAGE.
28
28
 */
29
29
 
30
 
#include <config.h>
 
30
#include "config.h"
31
31
 
32
32
#include "stats_table.h"
 
33
#include "sysvar_holder.h"
33
34
 
34
 
#include <drizzled/error.h>
 
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 */