~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/shutdown_function/shutdown.cc

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2010 Brian Aker
 
5
 */
 
6
 
 
7
#include "config.h"
 
8
 
 
9
#include <signal.h>
 
10
#include <drizzled/session.h>
 
11
#include <drizzled/function/str/strfunc.h>
 
12
 
 
13
using namespace drizzled;
 
14
 
 
15
#define SHUTDOWN_MESSAGE "Beginning shutdown"
 
16
 
 
17
class Shutdown :public Item_str_func
 
18
{
 
19
public:
 
20
  Shutdown() :
 
21
    Item_str_func()
 
22
  { }
 
23
 
 
24
 
 
25
  void fix_length_and_dec()
 
26
  {
 
27
    max_length= sizeof(SHUTDOWN_MESSAGE) * system_charset_info->mbmaxlen;
 
28
    maybe_null= true;
 
29
  }
 
30
  const char *func_name() const { return "shutdown"; }
 
31
  const char *fully_qualified_func_name() const { return "shutdown()"; }
 
32
 
 
33
  String *val_str(String *str)
 
34
  {
 
35
    kill_drizzle();
 
36
 
 
37
    str->copy(SHUTDOWN_MESSAGE, sizeof(SHUTDOWN_MESSAGE) -1, system_charset_info);
 
38
 
 
39
    return str;
 
40
  }
 
41
};
 
42
 
 
43
static int initialize(drizzled::module::Context &context)
 
44
{
 
45
  context.add(new plugin::Create_function<Shutdown>("shutdown"));
 
46
  return 0;
 
47
}
 
48
 
 
49
DRIZZLE_DECLARE_PLUGIN
 
50
{
 
51
  DRIZZLE_VERSION_ID,
 
52
  "shutdown",
 
53
  "1.0",
 
54
  "Brian Aker",
 
55
  "Cause the database to shutdown.",
 
56
  PLUGIN_LICENSE_BSD,
 
57
  initialize, /* Plugin Init */
 
58
  NULL,   /* system variables */
 
59
  NULL    /* config options */
 
60
}
 
61
DRIZZLE_DECLARE_PLUGIN_END;