~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/length/length.cc

  • Committer: Brian Aker
  • Date: 2009-08-21 06:18:23 UTC
  • mfrom: (1115.3.12 captain)
  • Revision ID: brian@gaz-20090821061823-ljcpbpvun22lsvem
Merge Jay

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/slot/function.h>
23
23
 
24
24
using namespace std;
 
25
using namespace drizzled;
25
26
 
26
27
class LengthFunction :public Item_int_func
27
28
{
61
62
  return (int64_t) res->length();
62
63
}
63
64
 
64
 
Create_function<LengthFunction> lengthudf(string("length"));
65
 
Create_function<LengthFunction> octetlengthudf(string("octet_length"));
 
65
plugin::Create_function<LengthFunction> *lengthudf= NULL;
66
66
 
67
67
static int initialize(drizzled::plugin::Registry &registry)
68
68
{
69
 
  registry.add(&lengthudf);
70
 
  registry.add(&octetlengthudf);
 
69
  lengthudf= new plugin::Create_function<LengthFunction>("length");
 
70
  lengthudf->addAlias("octet_length");
 
71
  registry.function.add(lengthudf);
71
72
  return 0;
72
73
}
73
74
 
74
75
static int finalize(drizzled::plugin::Registry &registry)
75
76
{
76
 
   registry.remove(&lengthudf);
77
 
   registry.remove(&octetlengthudf);
 
77
   registry.function.remove(lengthudf);
 
78
   delete lengthudf;
78
79
   return 0;
79
80
}
80
81