~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/version/versionudf.cc

  • Committer: Monty Taylor
  • Date: 2009-10-06 19:14:39 UTC
  • mfrom: (1130.2.18 plugin-base-class)
  • mto: This revision was merged to the branch mainline in revision 1184.
  • Revision ID: mordred@inaugust.com-20091006191439-fd1vvlp22654l3k3
Merged latest plugin-base-class.

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"
 
20
#include <drizzled/server_includes.h>
21
21
#include <drizzled/function/str/strfunc.h>
22
22
#include <drizzled/plugin/function.h>
23
 
#include "drizzled/version.h"
24
23
 
25
24
using namespace std;
26
25
using namespace drizzled;
46
45
 
47
46
String *VersionFunction::val_str(String *str)
48
47
{
49
 
  str->set(::drizzled::version().c_str(), ::drizzled::version().size(),
50
 
           system_charset_info);
 
48
  str->set(STRING_WITH_LEN(VERSION),system_charset_info);
51
49
  return str;
52
50
}
53
51
 
54
52
plugin::Create_function<VersionFunction> *versionudf= NULL;
55
53
 
56
 
static int initialize(module::Context &context)
 
54
static int initialize(plugin::Registry &registry)
57
55
{
58
56
  versionudf= new plugin::Create_function<VersionFunction>("version");
59
 
  context.add(versionudf);
 
57
  registry.add(versionudf);
60
58
  return 0;
61
59
}
62
60
 
63
 
DRIZZLE_PLUGIN(initialize, NULL, NULL);
 
61
static int finalize(plugin::Registry &registry)
 
62
{
 
63
   registry.remove(versionudf);
 
64
   delete versionudf;
 
65
   return 0;
 
66
}
 
67
 
 
68
drizzle_declare_plugin(version)
 
69
{
 
70
  "version",
 
71
  "1.0",
 
72
  "Devananda van der Veen",
 
73
  "Return the server version",
 
74
  PLUGIN_LICENSE_GPL,
 
75
  initialize, /* Plugin Init */
 
76
  finalize,   /* Plugin Deinit */
 
77
  NULL,   /* status variables */
 
78
  NULL,   /* system variables */
 
79
  NULL    /* config options */
 
80
}
 
81
drizzle_declare_plugin_end;