~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/debug/module.cc

  • Committer: Brian Aker
  • Date: 2011-02-22 06:12:02 UTC
  • mfrom: (2190.1.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110222061202-k03czxykqy4x9hjs
List update, header fixes, multiple symbols, and David deletes some code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 *
35
35
 */
36
36
 
37
 
#include "config.h"
 
37
#include <config.h>
38
38
 
39
39
#include <signal.h>
40
40
 
41
 
#include <drizzled/util/backtrace.h>
42
41
#include <drizzled/function/func.h>
43
42
#include <drizzled/item/cmpfunc.h>
 
43
#include <drizzled/item/function/boolean.h>
 
44
#include <drizzled/plugin/function.h>
 
45
#include <drizzled/util/backtrace.h>
44
46
 
45
47
using namespace drizzled;
46
48
 
47
49
namespace debug {
48
50
 
49
 
class Assert :public Item_bool_func
 
51
class Assert :public item::function::Boolean
50
52
{
51
53
public:
52
54
  Assert() :
53
 
    Item_bool_func()
 
55
    item::function::Boolean()
54
56
  {
55
57
    unsigned_flag= true;
56
58
  }
57
59
 
58
 
  const char *func_name() const { return "assert"; }
59
 
  const char *fully_qualified_func_name() const { return "assert()"; }
 
60
  const char *func_name() const { return "assert_and_crash"; }
 
61
  const char *fully_qualified_func_name() const { return "assert_and_crash()"; }
60
62
 
61
63
  bool val_bool()
62
64
  {
63
 
    drizzled::String _res;
64
 
    drizzled::String *res= args[0]->val_str(&_res);
 
65
    String _res;
 
66
    String *res= args[0]->val_str(&_res);
65
67
 
66
68
    null_value= false;
67
69
 
85
87
  }
86
88
};
87
89
 
88
 
class Backtrace :public Item_bool_func
 
90
class Backtrace :public item::function::Boolean
89
91
{
90
92
public:
91
93
  Backtrace() :
92
 
    Item_bool_func()
 
94
    item::function::Boolean()
93
95
  {
94
96
    unsigned_flag= true;
95
97
  }
99
101
 
100
102
  bool val_bool()
101
103
  {
102
 
    drizzled::util::custom_backtrace();
 
104
    util::custom_backtrace();
103
105
    return true;
104
106
  }
105
107
 
109
111
  }
110
112
};
111
113
 
112
 
class Crash :public Item_bool_func
 
114
class Crash :public item::function::Boolean
113
115
{
114
116
public:
115
117
  Crash() :
116
 
    Item_bool_func()
 
118
    item::function::Boolean()
117
119
  { }
118
120
 
119
121
  const char *func_name() const { return "crash"; }
136
138
 
137
139
static int initialize(drizzled::module::Context &context)
138
140
{
139
 
  context.add(new drizzled::plugin::Create_function<debug::Assert>("assert"));
 
141
  context.add(new drizzled::plugin::Create_function<debug::Assert>("assert_and_crash"));
140
142
  context.add(new drizzled::plugin::Create_function<debug::Backtrace>("backtrace"));
141
143
  context.add(new drizzled::plugin::Create_function<debug::Crash>("crash"));
142
144
 
152
154
  "Useful functions for programmers to debug the server.",
153
155
  PLUGIN_LICENSE_BSD,
154
156
  initialize, /* Plugin Init */
155
 
  NULL,   /* system variables */
 
157
  NULL,   /* depends */
156
158
  NULL    /* config options */
157
159
}
158
160
DRIZZLE_DECLARE_PLUGIN_END;