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/function.h>
21
#include <drizzled/item/func.h>
22
#include "drizzled/charset.h"
23
#include <drizzled/function/str/strfunc.h>
24
#include "libinnodb_version_func.h"
26
#include "embedded_innodb-1.0/innodb.h"
29
using namespace drizzled;
31
class LibinnodbVersionFunction : public Item_str_func
34
LibinnodbVersionFunction() : Item_str_func() {}
35
String *val_str(String*);
37
void fix_length_and_dec()
42
const char *func_name() const
44
return "libinnodb_version";
47
bool check_argument_count(int n)
54
String *LibinnodbVersionFunction::val_str(String *str)
56
assert(fixed == true);
66
uint64_t version= ib_api_version();
68
int len= snprintf((char *) str->ptr(), 50,
69
"Release %"PRIx64", Revision %"PRIx64", Age %"PRIx64,
71
(version >> 16) & 0xffff,
80
plugin::Create_function<LibinnodbVersionFunction> *libinnodb_version_func= NULL;
82
int libinnodb_version_func_initialize(plugin::Context &context)
84
libinnodb_version_func= new plugin::Create_function<LibinnodbVersionFunction>("libinnodb_version");
85
context.add(libinnodb_version_func);