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

« back to all changes in this revision

Viewing changes to plugin/crash_function/crash.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
class Crash :public Item_str_func
 
16
{
 
17
public:
 
18
  Crash() :
 
19
    Item_str_func()
 
20
  { }
 
21
 
 
22
 
 
23
  void fix_length_and_dec()
 
24
  {
 
25
    max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen;
 
26
    maybe_null= true;
 
27
  }
 
28
  const char *func_name() const { return "crash"; }
 
29
  const char *fully_qualified_func_name() const { return "crash()"; }
 
30
 
 
31
  String *val_str(String *str)
 
32
  {
 
33
    raise(SIGSEGV);
 
34
 
 
35
    return str;
 
36
  }
 
37
};
 
38
 
 
39
static int initialize(drizzled::module::Context &context)
 
40
{
 
41
  context.add(new plugin::Create_function<Crash>("crash"));
 
42
  return 0;
 
43
}
 
44
 
 
45
DRIZZLE_DECLARE_PLUGIN
 
46
{
 
47
  DRIZZLE_VERSION_ID,
 
48
  "crash",
 
49
  "1.0",
 
50
  "Brian Aker",
 
51
  "Cause the database to crash.",
 
52
  PLUGIN_LICENSE_BSD,
 
53
  initialize, /* Plugin Init */
 
54
  NULL,   /* system variables */
 
55
  NULL    /* config options */
 
56
}
 
57
DRIZZLE_DECLARE_PLUGIN_END;