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