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