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