17
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#include <drizzled/server_includes.h>
21
21
#include <drizzled/function/math/int.h>
22
#include <drizzled/plugin/function.h>
22
#include <drizzled/function/create.h>
24
24
using namespace std;
25
using namespace drizzled;
27
26
class CharLengthFunction :public Item_int_func
63
62
return (int64_t) res->numchars();
66
plugin::Create_function<CharLengthFunction> *charlengthudf= NULL;
67
plugin::Create_function<CharLengthFunction> *characterlengthudf= NULL;
65
Create_function<CharLengthFunction> charlengthudf(string("char_length"));
66
Create_function<CharLengthFunction> characterlengthudf(string("character_length"));
69
static int initialize(drizzled::plugin::Context &context)
68
static int initialize(PluginRegistry ®istry)
71
charlengthudf= new plugin::Create_function<CharLengthFunction>("char_length");
72
characterlengthudf= new plugin::Create_function<CharLengthFunction>("character_length");
73
context.add(charlengthudf);
74
context.add(characterlengthudf);
70
registry.add(&charlengthudf);
71
registry.add(&characterlengthudf);
78
DRIZZLE_DECLARE_PLUGIN
75
static int finalize(PluginRegistry ®istry)
77
registry.remove(&charlengthudf);
78
registry.remove(&characterlengthudf);
82
drizzle_declare_plugin(charlength)
83
86
"Devananda van der Veen",
84
87
"Return the number of characters in a string",
85
88
PLUGIN_LICENSE_GPL,
86
89
initialize, /* Plugin Init */
90
finalize, /* Plugin Deinit */
91
NULL, /* status variables */
87
92
NULL, /* system variables */
88
93
NULL /* config options */
90
DRIZZLE_DECLARE_PLUGIN_END;
95
drizzle_declare_plugin_end;