~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/charlength/charlength.cc

  • Committer: Monty Taylor
  • Date: 2009-08-24 14:57:56 UTC
  • mfrom: (1122 staging)
  • mto: This revision was merged to the branch mainline in revision 1124.
  • Revision ID: mordred@inaugust.com-20090824145756-7gw6t1l4ncgm455c
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
#include <drizzled/server_includes.h>
21
21
#include <drizzled/function/math/int.h>
22
 
#include <drizzled/function/create.h>
 
22
#include <drizzled/plugin/function.h>
23
23
 
24
24
using namespace std;
 
25
using namespace drizzled;
25
26
 
26
27
class CharLengthFunction :public Item_int_func
27
28
{
62
63
  return (int64_t) res->numchars();
63
64
}
64
65
 
65
 
Create_function<CharLengthFunction> charlengthudf(string("char_length"));
66
 
Create_function<CharLengthFunction> characterlengthudf(string("character_length"));
 
66
plugin::Create_function<CharLengthFunction> *charlengthudf= NULL;
67
67
 
68
68
static int initialize(drizzled::plugin::Registry &registry)
69
69
{
70
 
  registry.add(&charlengthudf);
71
 
  registry.add(&characterlengthudf);
 
70
  charlengthudf= new plugin::Create_function<CharLengthFunction>("char_length");
 
71
  charlengthudf->addAlias("character_length");
 
72
  registry.function.add(charlengthudf);
72
73
  return 0;
73
74
}
74
75
 
75
76
static int finalize(drizzled::plugin::Registry &registry)
76
77
{
77
 
   registry.remove(&charlengthudf);
78
 
   registry.remove(&characterlengthudf);
 
78
   registry.function.remove(charlengthudf);
 
79
   delete charlengthudf;
79
80
   return 0;
80
81
}
81
82