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 "haildb_version_func.h"
26
#if defined(HAVE_HAILDB_H)
29
# include <embedded_innodb-1.0/innodb.h>
30
#endif /* HAVE_HAILDB_H */
33
using namespace drizzled;
35
class HailDBVersionFunction : public Item_str_func
38
HailDBVersionFunction() : Item_str_func() {}
39
String *val_str(String*);
41
void fix_length_and_dec()
46
const char *func_name() const
48
return "haildb_version";
51
bool check_argument_count(int n)
58
String *HailDBVersionFunction::val_str(String *str)
60
assert(fixed == true);
70
uint64_t version= ib_api_version();
72
int len= snprintf((char *) str->ptr(), 50,
73
"Release %"PRIx64", Revision %"PRIx64", Age %"PRIx64,
75
(version >> 16) & 0xffff,
84
plugin::Create_function<HailDBVersionFunction> *haildb_version_func= NULL;
86
int haildb_version_func_initialize(module::Context &context)
88
haildb_version_func= new plugin::Create_function<HailDBVersionFunction>("haildb_version");
89
context.add(haildb_version_func);