~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/version/versionudf.cc

  • Committer: Brian Aker
  • Date: 2009-08-04 06:21:17 UTC
  • mfrom: (1108.2.2 merge)
  • Revision ID: brian@gaz-20090804062117-fef8x6y3ydzrvab3
Merge Brian

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