~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/hex_functions/hex_functions.cc

  • Committer: Brian Aker
  • Date: 2010-03-15 21:50:05 UTC
  • mto: This revision was merged to the branch mainline in revision 1343.
  • Revision ID: brian@gaz-20100315215005-oqoblpbll9n0albj
Merge of table cache/def DD.

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
18
18
 */
19
19
 
20
20
#include "config.h"
 
21
#include <drizzled/util/convert.h>
 
22
#include "drizzled/internal/m_string.h"
21
23
 
22
 
#include <drizzled/charset_info.h>
 
24
#include <drizzled/plugin/function.h>
23
25
#include <drizzled/function/str/strfunc.h>
24
 
#include <drizzled/internal/m_string.h>
25
 
#include <drizzled/plugin/function.h>
26
 
#include <drizzled/util/convert.h>
27
26
 
28
27
using namespace drizzled;
29
28
 
166
165
plugin::Create_function<HexFunction> *hex_function= NULL;
167
166
plugin::Create_function<UnHexFunction> *unhex_function= NULL;
168
167
 
169
 
static int initialize(drizzled::module::Context &context)
 
168
static int initialize(drizzled::plugin::Registry &registry)
170
169
{
171
170
  hex_function= new plugin::Create_function<HexFunction>("hex");
172
171
  unhex_function= new plugin::Create_function<UnHexFunction>("unhex");
173
 
  context.add(hex_function);
174
 
  context.add(unhex_function);
 
172
  registry.add(hex_function);
 
173
  registry.add(unhex_function);
175
174
  return 0;
176
175
}
177
176
 
 
177
static int finalize(drizzled::plugin::Registry &registry)
 
178
{
 
179
   registry.remove(hex_function);
 
180
   registry.remove(unhex_function);
 
181
   delete hex_function;
 
182
   delete unhex_function;
 
183
   return 0;
 
184
}
 
185
 
178
186
DRIZZLE_DECLARE_PLUGIN
179
187
{
180
188
  DRIZZLE_VERSION_ID,
184
192
  "Convert a string to HEX() or from UNHEX()",
185
193
  PLUGIN_LICENSE_GPL,
186
194
  initialize, /* Plugin Init */
187
 
  NULL,   /* depends */
 
195
  finalize,   /* Plugin Deinit */
 
196
  NULL,   /* system variables */
188
197
  NULL    /* config options */
189
198
}
190
199
DRIZZLE_DECLARE_PLUGIN_END;