~drizzle-trunk/drizzle/development

390.1.2 by Monty Taylor
Fixed copyright headers in drizzled/
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008 Sun Microsystems
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; version 2 of the License.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License
16
 *  along with this program; if not, write to the Free Software
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
1 by brian
clean slate
19
518 by Brian Aker
Firt pass to remove C/C++ funkiness around declaration of THD.
20
#ifndef DRIZZLED_PLUGIN_H
21
#define DRIZZLED_PLUGIN_H
1 by brian
clean slate
22
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
23
#include "drizzled/module/manifest.h"
24
#include "drizzled/module/module.h"
1253.2.1 by Monty Taylor
Moved plugin versioning out of drizzled/configmake.h and into drizzled/plugin/version.h. Also fixed header include paths.
25
#include "drizzled/plugin/version.h"
1530.2.6 by Monty Taylor
Moved plugin::Context to module::Context.
26
#include "drizzled/module/context.h"
1241.9.44 by Monty Taylor
Made magic with cached_directory.
27
#include "drizzled/definitions.h"
316 by Brian Aker
First pass of new sql_db.cc work
28
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
29
#include "drizzled/lex_string.h"
30
#include "drizzled/xid.h"
1633.1.1 by Monty Taylor
Added in support for program_options output in --help output.
31
#include <boost/program_options.hpp>
1813.2.7 by Monty Taylor
Migrated plugin_dir to fs::path.
32
#include <boost/filesystem.hpp>
1241.9.1 by Monty Taylor
Removed global.h. Fixed all the headers.
33
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
34
namespace drizzled
35
{
36
520.1.21 by Brian Aker
THD -> Session rename
37
class Session;
1 by brian
clean slate
38
class Item;
1093.1.62 by Monty Taylor
Moved UDFs to slot organization.
39
struct charset_info_st;
1 by brian
clean slate
40
41
/*************************************************************************
42
  Plugin API. Common for all plugin types.
43
*/
44
45
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
46
class sys_var;
1228.1.5 by Monty Taylor
Merged in some naming things.
47
typedef drizzle_lex_string LEX_STRING;
1410.3.4 by Djellel E. Difallah
update references to old my_'s
48
struct option;
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
49
1813.2.7 by Monty Taylor
Migrated plugin_dir to fs::path.
50
extern boost::filesystem::path plugin_dir;
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
51
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
52
namespace plugin { class StorageEngine; }
1130.2.1 by Monty Taylor
Introduced plugin::Plugin class. Made Function use it.
53
1 by brian
clean slate
54
/*
813.2.1 by Toru Maesaka
Renamed mysql_declare_plugin to drizzle_declare_plugin
55
  Macros for beginning and ending plugin declarations. Between
1228.1.5 by Monty Taylor
Merged in some naming things.
56
  DRIZZLE_DECLARE_PLUGIN and DRIZZLE_DECLARE_PLUGIN_END there should
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
57
  be a module::Manifest for each plugin to be declared.
1 by brian
clean slate
58
*/
59
60
1241.10.1 by Monty Taylor
Added ability to specify all of the meta information in the plugin.ini file. This allows us to have a streamlined out-of-tree build.
61
#define PANDORA_CPP_NAME(x) _drizzled_ ## x ## _plugin_
62
#define PANDORA_PLUGIN_NAME(x) PANDORA_CPP_NAME(x)
63
#define DRIZZLE_DECLARE_PLUGIN \
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
64
  ::drizzled::module::Manifest PANDORA_PLUGIN_NAME(PANDORA_MODULE_NAME)= 
1241.12.6 by Monty Taylor
We don't actually support an array of these, so remove the extra bits.
65
66
67
#define DRIZZLE_DECLARE_PLUGIN_END
1633.6.2 by Vijay Samuel
Reverted changes.
68
#define DRIZZLE_PLUGIN(init,system,options) \
1241.10.1 by Monty Taylor
Added ability to specify all of the meta information in the plugin.ini file. This allows us to have a streamlined out-of-tree build.
69
  DRIZZLE_DECLARE_PLUGIN \
70
  { \
1241.10.2 by Monty Taylor
Added support for embedding the drizzle version number in the plugin file.
71
    DRIZZLE_VERSION_ID, \
1241.10.1 by Monty Taylor
Added ability to specify all of the meta information in the plugin.ini file. This allows us to have a streamlined out-of-tree build.
72
    STRINGIFY_ARG(PANDORA_MODULE_NAME), \
73
    STRINGIFY_ARG(PANDORA_MODULE_VERSION), \
74
    STRINGIFY_ARG(PANDORA_MODULE_AUTHOR), \
75
    STRINGIFY_ARG(PANDORA_MODULE_TITLE), \
76
    PANDORA_MODULE_LICENSE, \
1633.6.2 by Vijay Samuel
Reverted changes.
77
    init, system, options \
1241.12.6 by Monty Taylor
We don't actually support an array of these, so remove the extra bits.
78
  } 
1093.3.1 by Monty Taylor
Rename of plugin classes.
79
80
971.1.61 by Monty Taylor
Moved a few things around in headers.
81
/*
1 by brian
clean slate
82
  declarations for SHOW STATUS support in plugins
83
*/
84
enum enum_mysql_show_type
85
{
86
  SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG,
87
  SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
1689.2.18 by Brian Aker
Move more of MyISAM out to MyISAM.
88
  SHOW_FUNC,
1280.1.3 by Brian Aker
Fixing test cases/removed dead optimizer switches.
89
  SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS,
971.1.61 by Monty Taylor
Moved a few things around in headers.
90
  SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, SHOW_INT_NOFLUSH,
91
  SHOW_LONGLONG_STATUS, SHOW_DOUBLE, SHOW_SIZE
1 by brian
clean slate
92
};
93
1228.1.5 by Monty Taylor
Merged in some naming things.
94
struct drizzle_show_var {
1 by brian
clean slate
95
  const char *name;
96
  char *value;
97
  enum enum_mysql_show_type type;
98
};
99
971.1.61 by Monty Taylor
Moved a few things around in headers.
100
typedef enum enum_mysql_show_type SHOW_TYPE;
101
77.1.9 by Monty Taylor
All of storage/ compiles clean now.
102
1 by brian
clean slate
103
#define SHOW_VAR_FUNC_BUFF_SIZE 1024
1228.1.5 by Monty Taylor
Merged in some naming things.
104
typedef int (*mysql_show_var_func)(drizzle_show_var *, char *);
1 by brian
clean slate
105
77.1.45 by Monty Taylor
Warning fixes.
106
struct st_show_var_func_container {
107
  mysql_show_var_func func;
108
};
1 by brian
clean slate
109
/*
110
  declarations for server variables and command line options
111
*/
112
113
114
#define PLUGIN_VAR_BOOL         0x0001
115
#define PLUGIN_VAR_INT          0x0002
116
#define PLUGIN_VAR_LONG         0x0003
117
#define PLUGIN_VAR_LONGLONG     0x0004
118
#define PLUGIN_VAR_STR          0x0005
119
#define PLUGIN_VAR_UNSIGNED     0x0080
520.1.21 by Brian Aker
THD -> Session rename
120
#define PLUGIN_VAR_SessionLOCAL     0x0100 /* Variable is per-connection */
1 by brian
clean slate
121
#define PLUGIN_VAR_READONLY     0x0200 /* Server variable is read only */
122
#define PLUGIN_VAR_NOSYSVAR     0x0400 /* Not a server variable */
123
#define PLUGIN_VAR_NOCMDOPT     0x0800 /* Not a command line option */
124
#define PLUGIN_VAR_NOCMDARG     0x1000 /* No argument for cmd line */
125
#define PLUGIN_VAR_RQCMDARG     0x0000 /* Argument required for cmd line */
126
#define PLUGIN_VAR_OPCMDARG     0x2000 /* Argument optional for cmd line */
127
#define PLUGIN_VAR_MEMALLOC     0x8000 /* String needs memory allocated */
128
1228.1.5 by Monty Taylor
Merged in some naming things.
129
struct drizzle_sys_var;
130
struct drizzle_value;
1 by brian
clean slate
131
132
/*
133
  SYNOPSIS
134
    (*mysql_var_check_func)()
520.1.22 by Brian Aker
Second pass of thd cleanup
135
      session               thread handle
1 by brian
clean slate
136
      var               dynamic variable being altered
137
      save              pointer to temporary storage
138
      value             user provided value
139
  RETURN
140
    0   user provided value is OK and the update func may be called.
141
    any other value indicates error.
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
142
1 by brian
clean slate
143
  This function should parse the user provided value and store in the
144
  provided temporary storage any data as required by the update func.
145
  There is sufficient space in the temporary storage to store a double.
146
  Note that the update func may not be called if any other error occurs
147
  so any memory allocated should be thread-local so that it may be freed
148
  automatically at the end of the statement.
149
*/
150
520.1.22 by Brian Aker
Second pass of thd cleanup
151
typedef int (*mysql_var_check_func)(Session *session,
1228.1.5 by Monty Taylor
Merged in some naming things.
152
                                    drizzle_sys_var *var,
153
                                    void *save, drizzle_value *value);
1 by brian
clean slate
154
155
/*
156
  SYNOPSIS
157
    (*mysql_var_update_func)()
520.1.22 by Brian Aker
Second pass of thd cleanup
158
      session               thread handle
1 by brian
clean slate
159
      var               dynamic variable being altered
160
      var_ptr           pointer to dynamic variable
161
      save              pointer to temporary storage
162
   RETURN
163
     NONE
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
164
1 by brian
clean slate
165
   This function should use the validated value stored in the temporary store
166
   and persist it in the provided pointer to the dynamic variable.
167
   For example, strings may require memory to be allocated.
168
*/
520.1.22 by Brian Aker
Second pass of thd cleanup
169
typedef void (*mysql_var_update_func)(Session *session,
1228.1.5 by Monty Taylor
Merged in some naming things.
170
                                      drizzle_sys_var *var,
1 by brian
clean slate
171
                                      void *var_ptr, const void *save);
172
173
174
/* the following declarations are for internal use only */
175
176
177
#define PLUGIN_VAR_MASK \
178
        (PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | \
179
         PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \
180
         PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC)
181
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
182
#define DRIZZLE_PLUGIN_VAR_HEADER \
1 by brian
clean slate
183
  int flags;                    \
184
  const char *name;             \
185
  const char *comment;          \
186
  mysql_var_check_func check;   \
187
  mysql_var_update_func update
188
1643.2.1 by Monty Taylor
Fixed hold-over name. Should never matter, but bleh.
189
#define DRIZZLE_SYSVAR_NAME(name) drizzle_sysvar_ ## name
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
190
#define DRIZZLE_SYSVAR(name) \
1228.2.1 by Monty Taylor
Fixed Solaris. Duh.
191
  ((drizzle_sys_var *)(&(DRIZZLE_SYSVAR_NAME(name))))
1 by brian
clean slate
192
193
/*
194
  for global variables, the value pointer is the first
195
  element after the header, the default value is the second.
196
  for thread variables, the value offset is the first
197
  element after the header, the default value is the second.
198
*/
660.1.3 by Eric Herman
removed trailing whitespace with simple script:
199
1 by brian
clean slate
200
1816.2.4 by Monty Taylor
Cleaned up a bunch more warnings.
201
#define DECLARE_DRIZZLE_SYSVAR_BOOL(name) struct { \
202
  DRIZZLE_PLUGIN_VAR_HEADER;      \
203
  bool *value;                  \
204
  bool def_val;           \
205
} DRIZZLE_SYSVAR_NAME(name)
206
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
207
#define DECLARE_DRIZZLE_SYSVAR_BASIC(name, type) struct { \
208
  DRIZZLE_PLUGIN_VAR_HEADER;      \
1 by brian
clean slate
209
  type *value;                  \
210
  const type def_val;           \
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
211
} DRIZZLE_SYSVAR_NAME(name)
1 by brian
clean slate
212
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
213
#define DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, type) struct { \
214
  DRIZZLE_PLUGIN_VAR_HEADER;      \
1 by brian
clean slate
215
  type *value; type def_val;    \
216
  type min_val; type max_val;   \
217
  type blk_sz;                  \
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
218
} DRIZZLE_SYSVAR_NAME(name)
1 by brian
clean slate
219
520.1.21 by Brian Aker
THD -> Session rename
220
#define DECLARE_SessionVAR_FUNC(type) \
520.1.22 by Brian Aker
Second pass of thd cleanup
221
  type *(*resolve)(Session *session, int offset)
1 by brian
clean slate
222
520.1.21 by Brian Aker
THD -> Session rename
223
#define DECLARE_DRIZZLE_SessionVAR_BASIC(name, type) struct { \
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
224
  DRIZZLE_PLUGIN_VAR_HEADER;      \
1 by brian
clean slate
225
  int offset;                   \
226
  const type def_val;           \
520.1.21 by Brian Aker
THD -> Session rename
227
  DECLARE_SessionVAR_FUNC(type);    \
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
228
} DRIZZLE_SYSVAR_NAME(name)
1 by brian
clean slate
229
1816.2.4 by Monty Taylor
Cleaned up a bunch more warnings.
230
#define DECLARE_DRIZZLE_SessionVAR_BOOL(name) struct { \
231
  DRIZZLE_PLUGIN_VAR_HEADER;      \
232
  int offset;                   \
233
  bool def_val;           \
234
  DECLARE_SessionVAR_FUNC(bool);    \
235
} DRIZZLE_SYSVAR_NAME(name)
236
520.1.21 by Brian Aker
THD -> Session rename
237
#define DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, type) struct { \
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
238
  DRIZZLE_PLUGIN_VAR_HEADER;      \
1 by brian
clean slate
239
  int offset;                   \
240
  type def_val; type min_val;   \
241
  type max_val; type blk_sz;    \
520.1.21 by Brian Aker
THD -> Session rename
242
  DECLARE_SessionVAR_FUNC(type);    \
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
243
} DRIZZLE_SYSVAR_NAME(name)
1 by brian
clean slate
244
520.1.21 by Brian Aker
THD -> Session rename
245
#define DECLARE_DRIZZLE_SessionVAR_TYPELIB(name, type) struct { \
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
246
  DRIZZLE_PLUGIN_VAR_HEADER;      \
1 by brian
clean slate
247
  int offset;                   \
248
  type def_val;                 \
520.1.21 by Brian Aker
THD -> Session rename
249
  DECLARE_SessionVAR_FUNC(type);    \
1 by brian
clean slate
250
  TYPELIB *typelib;             \
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
251
} DRIZZLE_SYSVAR_NAME(name)
1 by brian
clean slate
252
253
254
/*
255
  the following declarations are for use by plugin implementors
256
*/
257
1816.2.4 by Monty Taylor
Cleaned up a bunch more warnings.
258
#define DECLARE_DRIZZLE_SYSVAR_BOOL(name) struct { \
1816.2.3 by Monty Taylor
Fixed some more ICC warnings. How did I get started on this this morning?
259
  DRIZZLE_PLUGIN_VAR_HEADER;      \
1816.2.4 by Monty Taylor
Cleaned up a bunch more warnings.
260
  bool *value;                  \
261
  bool def_val;           \
1816.2.3 by Monty Taylor
Fixed some more ICC warnings. How did I get started on this this morning?
262
} DRIZZLE_SYSVAR_NAME(name)
263
1816.2.4 by Monty Taylor
Cleaned up a bunch more warnings.
264
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
265
#define DRIZZLE_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
1816.2.4 by Monty Taylor
Cleaned up a bunch more warnings.
266
  DECLARE_DRIZZLE_SYSVAR_BOOL(name) = { \
1 by brian
clean slate
267
  PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \
268
  #name, comment, check, update, &varname, def}
269
1816.2.4 by Monty Taylor
Cleaned up a bunch more warnings.
270
#define DECLARE_DRIZZLE_SYSVAR_BASIC(name, type) struct { \
271
  DRIZZLE_PLUGIN_VAR_HEADER;      \
272
  type *value;                  \
273
  const type def_val;           \
274
} DRIZZLE_SYSVAR_NAME(name)
275
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
276
#define DRIZZLE_SYSVAR_STR(name, varname, opt, comment, check, update, def) \
277
DECLARE_DRIZZLE_SYSVAR_BASIC(name, char *) = { \
1 by brian
clean slate
278
  PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \
279
  #name, comment, check, update, &varname, def}
280
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
281
#define DRIZZLE_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \
282
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, int) = { \
1 by brian
clean slate
283
  PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \
284
  #name, comment, check, update, &varname, def, min, max, blk }
285
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
286
#define DRIZZLE_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \
287
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, unsigned int) = { \
1 by brian
clean slate
288
  PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
289
  #name, comment, check, update, &varname, def, min, max, blk }
290
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
291
#define DRIZZLE_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \
292
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, long) = { \
1 by brian
clean slate
293
  PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \
294
  #name, comment, check, update, &varname, def, min, max, blk }
295
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
296
#define DRIZZLE_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \
297
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, unsigned long) = { \
1 by brian
clean slate
298
  PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
299
  #name, comment, check, update, &varname, def, min, max, blk }
300
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
301
#define DRIZZLE_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
302
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, int64_t) = { \
1 by brian
clean slate
303
  PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \
304
  #name, comment, check, update, &varname, def, min, max, blk }
305
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
306
#define DRIZZLE_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
307
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, uint64_t) = { \
1 by brian
clean slate
308
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
309
  #name, comment, check, update, &varname, def, min, max, blk }
310
520.1.21 by Brian Aker
THD -> Session rename
311
#define DRIZZLE_SessionVAR_BOOL(name, opt, comment, check, update, def) \
1816.2.4 by Monty Taylor
Cleaned up a bunch more warnings.
312
DECLARE_DRIZZLE_SessionVAR_BOOL(name) = { \
520.1.21 by Brian Aker
THD -> Session rename
313
  PLUGIN_VAR_BOOL | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
314
  #name, comment, check, update, -1, def, NULL}
315
316
#define DRIZZLE_SessionVAR_STR(name, opt, comment, check, update, def) \
317
DECLARE_DRIZZLE_SessionVAR_BASIC(name, char *) = { \
318
  PLUGIN_VAR_STR | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
319
  #name, comment, check, update, -1, def, NULL}
320
321
#define DRIZZLE_SessionVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
322
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, int) = { \
323
  PLUGIN_VAR_INT | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
324
  #name, comment, check, update, -1, def, min, max, blk, NULL }
325
326
#define DRIZZLE_SessionVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
327
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, unsigned int) = { \
328
  PLUGIN_VAR_INT | PLUGIN_VAR_SessionLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
329
  #name, comment, check, update, -1, def, min, max, blk, NULL }
330
331
#define DRIZZLE_SessionVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
332
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, long) = { \
333
  PLUGIN_VAR_LONG | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
334
  #name, comment, check, update, -1, def, min, max, blk, NULL }
335
336
#define DRIZZLE_SessionVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
337
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, unsigned long) = { \
338
  PLUGIN_VAR_LONG | PLUGIN_VAR_SessionLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
339
  #name, comment, check, update, -1, def, min, max, blk, NULL }
340
341
#define DRIZZLE_SessionVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
342
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, int64_t) = { \
343
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
344
  #name, comment, check, update, -1, def, min, max, blk, NULL }
345
346
#define DRIZZLE_SessionVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
347
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, uint64_t) = { \
348
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_SessionLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
349
  #name, comment, check, update, -1, def, min, max, blk, NULL }
350
1 by brian
clean slate
351
/* accessor macros */
352
353
#define SYSVAR(name) \
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
354
  (*(DRIZZLE_SYSVAR_NAME(name).value))
1 by brian
clean slate
355
520.1.22 by Brian Aker
Second pass of thd cleanup
356
/* when session == null, result points to global value */
357
#define SessionVAR(session, name) \
358
  (*(DRIZZLE_SYSVAR_NAME(name).resolve(session, DRIZZLE_SYSVAR_NAME(name).offset)))
1 by brian
clean slate
359
360
361
/*************************************************************************
1228.1.5 by Monty Taylor
Merged in some naming things.
362
  drizzle_value struct for reading values from mysqld.
1 by brian
clean slate
363
  Used by server variables framework to parse user-provided values.
364
  Will be used for arguments when implementing UDFs.
365
366
  Note that val_str() returns a string in temporary memory
367
  that will be freed at the end of statement. Copy the string
368
  if you need it to persist.
369
*/
370
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
371
#define DRIZZLE_VALUE_TYPE_STRING 0
372
#define DRIZZLE_VALUE_TYPE_REAL   1
373
#define DRIZZLE_VALUE_TYPE_INT    2
1 by brian
clean slate
374
1251.2.2 by Jay Pipes
Pulls MyISAM-specific server variables into the MyISAM
375
/*
376
  skeleton of a plugin variable - portion of structure common to all.
377
*/
378
struct drizzle_sys_var
379
{
380
  DRIZZLE_PLUGIN_VAR_HEADER;
381
};
382
1410.3.4 by Djellel E. Difallah
update references to old my_'s
383
void plugin_opt_set_limits(option *options, const drizzle_sys_var *opt);
1251.2.2 by Jay Pipes
Pulls MyISAM-specific server variables into the MyISAM
384
1228.1.5 by Monty Taylor
Merged in some naming things.
385
struct drizzle_value
1 by brian
clean slate
386
{
1228.1.5 by Monty Taylor
Merged in some naming things.
387
  int (*value_type)(drizzle_value *);
388
  const char *(*val_str)(drizzle_value *, char *buffer, int *length);
389
  int (*val_real)(drizzle_value *, double *realbuf);
390
  int (*val_int)(drizzle_value *, int64_t *intbuf);
1 by brian
clean slate
391
};
392
393
394
/*************************************************************************
395
  Miscellaneous functions for plugin implementors
396
*/
397
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
398
extern bool plugin_init(module::Registry &registry,
1633.1.1 by Monty Taylor
Added in support for program_options output in --help output.
399
                        boost::program_options::options_description &long_options);
1794.3.5 by Monty Taylor
Fixed temporoary dir sequencing.
400
extern bool plugin_finalize(module::Registry &registry);
1757.2.3 by Monty Taylor
Made printing of --help work via program_options from the core. Removed
401
extern void my_print_help_inc_plugins(option *options);
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
402
extern bool plugin_is_ready(const LEX_STRING *name, int type);
403
extern void plugin_sessionvar_init(Session *session);
404
extern void plugin_sessionvar_cleanup(Session *session);
405
extern sys_var *intern_find_sys_var(const char *str, uint32_t, bool no_error);
406
520.1.22 by Brian Aker
Second pass of thd cleanup
407
int session_in_lock_tables(const Session *session);
408
int session_tablespace_op(const Session *session);
520.6.7 by Monty Taylor
Moved a bunch of crap out of common_includes.
409
void set_session_proc_info(Session *session, const char *info);
410
const char *get_session_proc_info(Session *session);
520.1.22 by Brian Aker
Second pass of thd cleanup
411
int64_t session_test_options(const Session *session, int64_t test_options);
412
int session_sql_command(const Session *session);
1578.7.1 by Stewart Smith
change session_tx_isolation() to return enum_tx_isolation instead of int. This means that in engines we can properly use a switch statement on the enum values and get warnings if we miss one.
413
enum_tx_isolation session_tx_isolation(const Session *session);
1 by brian
clean slate
414
1776.4.1 by Monty Taylor
Migrates the creation of the plugin lists to have program_options directly
415
void compose_plugin_add(std::vector<std::string> options);
416
void compose_plugin_remove(std::vector<std::string> options);
417
void notify_plugin_load(std::string in_plugin_load);
520.6.7 by Monty Taylor
Moved a bunch of crap out of common_includes.
418
419
1 by brian
clean slate
420
/**
421
  Create a temporary file.
422
423
  @details
424
  The temporary file is created in a location specified by the mysql
425
  server configuration (--tmpdir option).  The caller does not need to
426
  delete the file, it will be deleted automatically.
427
428
  @param prefix  prefix for temporary file name
429
  @retval -1    error
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
430
  @retval >= 0  a file handle that can be passed to dup or internal::my_close
1 by brian
clean slate
431
*/
432
int mysql_tmpfile(const char *prefix);
433
434
/**
435
  Check the killed state of a connection
436
437
  @details
438
  In MySQL support for the KILL statement is cooperative. The KILL
439
  statement only sets a "killed" flag. This function returns the value
440
  of that flag.  A thread should check it often, especially inside
441
  time-consuming loops, and gracefully abort the operation if it is
442
  non-zero.
443
520.1.22 by Brian Aker
Second pass of thd cleanup
444
  @param session  user thread connection handle
1 by brian
clean slate
445
  @retval 0  the connection is active
446
  @retval 1  the connection has been killed
447
*/
520.1.22 by Brian Aker
Second pass of thd cleanup
448
int session_killed(const Session *session);
1 by brian
clean slate
449
450
1085.1.2 by Monty Taylor
Fixed -Wmissing-declarations
451
const charset_info_st *session_charset(Session *session);
452
1 by brian
clean slate
453
/**
454
  Invalidate the query cache for a given table.
455
520.1.22 by Brian Aker
Second pass of thd cleanup
456
  @param session         user thread connection handle
1 by brian
clean slate
457
  @param key         databasename\\0tablename\\0
458
  @param key_length  length of key in bytes, including the NUL bytes
459
  @param using_trx   flag: TRUE if using transactions, FALSE otherwise
460
*/
520.1.22 by Brian Aker
Second pass of thd cleanup
461
void mysql_query_cache_invalidate4(Session *session,
1 by brian
clean slate
462
                                   const char *key, unsigned int key_length,
463
                                   int using_trx);
464
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
465
} /* namespace drizzled */
466
1122.2.10 by Monty Taylor
Fixed all of the include guards.
467
#endif /* DRIZZLED_PLUGIN_H */
1 by brian
clean slate
468