1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems, Inc.
4
* Copyright (C) 2008 Sun Microsystems
6
6
* This program is free software; you can redistribute it and/or modify
7
7
* it under the terms of the GNU General Public License as published by
17
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#include <drizzled/server_includes.h>
22
21
#include <drizzled/function/math/int.h>
23
#include <drizzled/plugin.h>
24
#include <drizzled/plugin/function.h>
22
#include <drizzled/function/create.h>
26
24
using namespace std;
27
using namespace drizzled;
29
26
class CharLengthFunction :public Item_int_func
65
62
return (int64_t) res->numchars();
68
plugin::Create_function<CharLengthFunction> *charlengthudf= NULL;
69
plugin::Create_function<CharLengthFunction> *characterlengthudf= NULL;
65
Create_function<CharLengthFunction> charlengthudf(string("char_length"));
66
Create_function<CharLengthFunction> characterlengthudf(string("character_length"));
71
static int initialize(drizzled::module::Context &context)
68
static int initialize(drizzled::plugin::Registry ®istry)
73
charlengthudf= new plugin::Create_function<CharLengthFunction>("char_length");
74
characterlengthudf= new plugin::Create_function<CharLengthFunction>("character_length");
75
context.add(charlengthudf);
76
context.add(characterlengthudf);
70
registry.add(&charlengthudf);
71
registry.add(&characterlengthudf);
80
DRIZZLE_DECLARE_PLUGIN
75
static int finalize(drizzled::plugin::Registry ®istry)
77
registry.remove(&charlengthudf);
78
registry.remove(&characterlengthudf);
82
drizzle_declare_plugin(charlength)
85
86
"Devananda van der Veen",
86
87
"Return the number of characters in a string",
87
88
PLUGIN_LICENSE_GPL,
88
89
initialize, /* Plugin Init */
90
finalize, /* Plugin Deinit */
91
NULL, /* status variables */
92
NULL, /* system variables */
90
93
NULL /* config options */
92
DRIZZLE_DECLARE_PLUGIN_END;
95
drizzle_declare_plugin_end;