2
Copyright (C) 2010 Stewart Smith
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License
6
as published by the Free Software Foundation; either version 2
7
of the License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
#include "drizzled/plugin/table_function.h"
24
#include "status_table_function.h"
27
using namespace drizzled;
29
class LibInnoDBStatusTool : public drizzled::plugin::TableFunction
33
LibInnoDBStatusTool();
35
LibInnoDBStatusTool(const char *table_arg) :
36
drizzled::plugin::TableFunction("data_dictionary", table_arg)
39
~LibInnoDBStatusTool() {}
41
class Generator : public drizzled::plugin::TableFunction::Generator
48
Generator(drizzled::Field **arg);
54
LibInnoDBStatusTool::Generator *generator(drizzled::Field **arg)
56
return new Generator(arg);
60
LibInnoDBStatusTool::LibInnoDBStatusTool() :
61
plugin::TableFunction("DATA_DICTIONARY", "HAILDB_STATUS")
64
add_field("VALUE", plugin::TableFunction::NUMBER);
67
LibInnoDBStatusTool::Generator::Generator(Field **arg) :
68
plugin::TableFunction::Generator(arg),
71
ib_err_t err= ib_status_get_all(&names, &names_count);
72
assert(err == DB_SUCCESS);
75
LibInnoDBStatusTool::Generator::~Generator()
80
bool LibInnoDBStatusTool::Generator::populate()
82
if (names[names_next] != NULL)
84
const char* config_name= names[names_next];
89
ib_err_t err= ib_status_get_i64(config_name, &value);
90
assert(err == DB_SUCCESS);
98
return false; // No more rows
101
static LibInnoDBStatusTool *status_tool;
103
int status_table_function_initialize(drizzled::module::Context &context)
105
status_tool= new(std::nothrow)LibInnoDBStatusTool();
106
context.add(status_tool);