~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/charlength/charlength.cc

Reworked getTableNames() interface. Way simpler, less mallocs....

Added a straight vector<> for use with storage engines.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
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
18
18
 */
19
19
 
20
 
#include "config.h"
21
 
 
 
20
#include <drizzled/server_includes.h>
22
21
#include <drizzled/function/math/int.h>
23
 
#include <drizzled/plugin.h>
24
22
#include <drizzled/plugin/function.h>
25
23
 
26
24
using namespace std;
66
64
}
67
65
 
68
66
plugin::Create_function<CharLengthFunction> *charlengthudf= NULL;
69
 
plugin::Create_function<CharLengthFunction> *characterlengthudf= NULL;
70
67
 
71
 
static int initialize(drizzled::module::Context &context)
 
68
static int initialize(drizzled::plugin::Registry &registry)
72
69
{
73
70
  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);
 
71
  charlengthudf->addAlias("character_length");
 
72
  registry.add(charlengthudf);
77
73
  return 0;
78
74
}
79
75
 
80
 
DRIZZLE_DECLARE_PLUGIN
81
 
{
82
 
  DRIZZLE_VERSION_ID,
 
76
static int finalize(drizzled::plugin::Registry &registry)
 
77
{
 
78
   registry.remove(charlengthudf);
 
79
   delete charlengthudf;
 
80
   return 0;
 
81
}
 
82
 
 
83
drizzle_declare_plugin(charlength)
 
84
{
83
85
  "charlength",
84
86
  "1.0",
85
87
  "Devananda van der Veen",
86
88
  "Return the number of characters in a string",
87
89
  PLUGIN_LICENSE_GPL,
88
90
  initialize, /* Plugin Init */
89
 
  NULL,   /* depends */
 
91
  finalize,   /* Plugin Deinit */
 
92
  NULL,   /* status variables */
 
93
  NULL,   /* system variables */
90
94
  NULL    /* config options */
91
95
}
92
 
DRIZZLE_DECLARE_PLUGIN_END;
 
96
drizzle_declare_plugin_end;