~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to drizzled/plugin.h

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-03-18 12:12:31 UTC
  • Revision ID: james.westby@ubuntu.com-20100318121231-k6g1xe6cshbwa0f8
Tags: upstream-2010.03.1347
ImportĀ upstreamĀ versionĀ 2010.03.1347

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 */
 
19
 
 
20
#ifndef DRIZZLED_PLUGIN_H
 
21
#define DRIZZLED_PLUGIN_H
 
22
 
 
23
#include <drizzled/lex_string.h>
 
24
#include <drizzled/xid.h>
 
25
#include <drizzled/plugin/manifest.h>
 
26
#include <drizzled/plugin/module.h>
 
27
#include "drizzled/plugin/version.h"
 
28
#include "drizzled/definitions.h"
 
29
 
 
30
 
 
31
namespace drizzled
 
32
{
 
33
 
 
34
class Session;
 
35
class Item;
 
36
struct charset_info_st;
 
37
 
 
38
/*************************************************************************
 
39
  Plugin API. Common for all plugin types.
 
40
*/
 
41
 
 
42
 
 
43
class sys_var;
 
44
typedef drizzle_lex_string LEX_STRING;
 
45
struct my_option;
 
46
 
 
47
extern char *opt_plugin_add;
 
48
extern char *opt_plugin_remove;
 
49
extern char *opt_plugin_load;
 
50
extern char *opt_plugin_dir_ptr;
 
51
extern char opt_plugin_dir[FN_REFLEN];
 
52
 
 
53
namespace plugin { class StorageEngine; }
 
54
 
 
55
/*
 
56
  Macros for beginning and ending plugin declarations. Between
 
57
  DRIZZLE_DECLARE_PLUGIN and DRIZZLE_DECLARE_PLUGIN_END there should
 
58
  be a plugin::Manifest for each plugin to be declared.
 
59
*/
 
60
 
 
61
 
 
62
#define PANDORA_CPP_NAME(x) _drizzled_ ## x ## _plugin_
 
63
#define PANDORA_PLUGIN_NAME(x) PANDORA_CPP_NAME(x)
 
64
#define DRIZZLE_DECLARE_PLUGIN \
 
65
  ::drizzled::plugin::Manifest PANDORA_PLUGIN_NAME(PANDORA_MODULE_NAME)= 
 
66
 
 
67
 
 
68
#define DRIZZLE_DECLARE_PLUGIN_END
 
69
#define DRIZZLE_PLUGIN(init,deinit,system) \
 
70
  DRIZZLE_DECLARE_PLUGIN \
 
71
  { \
 
72
    DRIZZLE_VERSION_ID, \
 
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, \
 
78
    init, deinit, system, NULL \
 
79
  } 
 
80
 
 
81
 
 
82
/*
 
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,
 
89
  SHOW_FUNC, SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_LONGLONG,
 
90
  SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS,
 
91
  SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, SHOW_INT_NOFLUSH,
 
92
  SHOW_LONGLONG_STATUS, SHOW_DOUBLE, SHOW_SIZE
 
93
};
 
94
 
 
95
struct drizzle_show_var {
 
96
  const char *name;
 
97
  char *value;
 
98
  enum enum_mysql_show_type type;
 
99
};
 
100
 
 
101
typedef enum enum_mysql_show_type SHOW_TYPE;
 
102
 
 
103
 
 
104
#define SHOW_VAR_FUNC_BUFF_SIZE 1024
 
105
typedef int (*mysql_show_var_func)(drizzle_show_var *, char *);
 
106
 
 
107
struct st_show_var_func_container {
 
108
  mysql_show_var_func func;
 
109
};
 
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
 
121
#define PLUGIN_VAR_SessionLOCAL     0x0100 /* Variable is per-connection */
 
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
 
 
130
struct drizzle_sys_var;
 
131
struct drizzle_value;
 
132
 
 
133
/*
 
134
  SYNOPSIS
 
135
    (*mysql_var_check_func)()
 
136
      session               thread handle
 
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.
 
143
 
 
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
 
 
152
typedef int (*mysql_var_check_func)(Session *session,
 
153
                                    drizzle_sys_var *var,
 
154
                                    void *save, drizzle_value *value);
 
155
 
 
156
/*
 
157
  SYNOPSIS
 
158
    (*mysql_var_update_func)()
 
159
      session               thread handle
 
160
      var               dynamic variable being altered
 
161
      var_ptr           pointer to dynamic variable
 
162
      save              pointer to temporary storage
 
163
   RETURN
 
164
     NONE
 
165
 
 
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
*/
 
170
typedef void (*mysql_var_update_func)(Session *session,
 
171
                                      drizzle_sys_var *var,
 
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
 
 
183
#define DRIZZLE_PLUGIN_VAR_HEADER \
 
184
  int flags;                    \
 
185
  const char *name;             \
 
186
  const char *comment;          \
 
187
  mysql_var_check_func check;   \
 
188
  mysql_var_update_func update
 
189
 
 
190
#define DRIZZLE_SYSVAR_NAME(name) mysql_sysvar_ ## name
 
191
#define DRIZZLE_SYSVAR(name) \
 
192
  ((drizzle_sys_var *)(&(DRIZZLE_SYSVAR_NAME(name))))
 
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
*/
 
200
 
 
201
 
 
202
#define DECLARE_DRIZZLE_SYSVAR_BASIC(name, type) struct { \
 
203
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
204
  type *value;                  \
 
205
  const type def_val;           \
 
206
} DRIZZLE_SYSVAR_NAME(name)
 
207
 
 
208
#define DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, type) struct { \
 
209
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
210
  type *value; type def_val;    \
 
211
  type min_val; type max_val;   \
 
212
  type blk_sz;                  \
 
213
} DRIZZLE_SYSVAR_NAME(name)
 
214
 
 
215
#define DECLARE_SessionVAR_FUNC(type) \
 
216
  type *(*resolve)(Session *session, int offset)
 
217
 
 
218
#define DECLARE_DRIZZLE_SessionVAR_BASIC(name, type) struct { \
 
219
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
220
  int offset;                   \
 
221
  const type def_val;           \
 
222
  DECLARE_SessionVAR_FUNC(type);    \
 
223
} DRIZZLE_SYSVAR_NAME(name)
 
224
 
 
225
#define DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, type) struct { \
 
226
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
227
  int offset;                   \
 
228
  type def_val; type min_val;   \
 
229
  type max_val; type blk_sz;    \
 
230
  DECLARE_SessionVAR_FUNC(type);    \
 
231
} DRIZZLE_SYSVAR_NAME(name)
 
232
 
 
233
#define DECLARE_DRIZZLE_SessionVAR_TYPELIB(name, type) struct { \
 
234
  DRIZZLE_PLUGIN_VAR_HEADER;      \
 
235
  int offset;                   \
 
236
  type def_val;                 \
 
237
  DECLARE_SessionVAR_FUNC(type);    \
 
238
  TYPELIB *typelib;             \
 
239
} DRIZZLE_SYSVAR_NAME(name)
 
240
 
 
241
 
 
242
/*
 
243
  the following declarations are for use by plugin implementors
 
244
*/
 
245
 
 
246
#define DRIZZLE_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
 
247
DECLARE_DRIZZLE_SYSVAR_BASIC(name, bool) = { \
 
248
  PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \
 
249
  #name, comment, check, update, &varname, def}
 
250
 
 
251
#define DRIZZLE_SYSVAR_STR(name, varname, opt, comment, check, update, def) \
 
252
DECLARE_DRIZZLE_SYSVAR_BASIC(name, char *) = { \
 
253
  PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \
 
254
  #name, comment, check, update, &varname, def}
 
255
 
 
256
#define DRIZZLE_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \
 
257
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, int) = { \
 
258
  PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \
 
259
  #name, comment, check, update, &varname, def, min, max, blk }
 
260
 
 
261
#define DRIZZLE_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \
 
262
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, unsigned int) = { \
 
263
  PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
 
264
  #name, comment, check, update, &varname, def, min, max, blk }
 
265
 
 
266
#define DRIZZLE_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \
 
267
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, long) = { \
 
268
  PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \
 
269
  #name, comment, check, update, &varname, def, min, max, blk }
 
270
 
 
271
#define DRIZZLE_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \
 
272
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, unsigned long) = { \
 
273
  PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
 
274
  #name, comment, check, update, &varname, def, min, max, blk }
 
275
 
 
276
#define DRIZZLE_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
 
277
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, int64_t) = { \
 
278
  PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \
 
279
  #name, comment, check, update, &varname, def, min, max, blk }
 
280
 
 
281
#define DRIZZLE_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
 
282
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, uint64_t) = { \
 
283
  PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
 
284
  #name, comment, check, update, &varname, def, min, max, blk }
 
285
 
 
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
 
 
326
/* accessor macros */
 
327
 
 
328
#define SYSVAR(name) \
 
329
  (*(DRIZZLE_SYSVAR_NAME(name).value))
 
330
 
 
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)))
 
334
 
 
335
 
 
336
/*************************************************************************
 
337
  drizzle_value struct for reading values from mysqld.
 
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
 
 
346
#define DRIZZLE_VALUE_TYPE_STRING 0
 
347
#define DRIZZLE_VALUE_TYPE_REAL   1
 
348
#define DRIZZLE_VALUE_TYPE_INT    2
 
349
 
 
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
 
 
360
struct drizzle_value
 
361
{
 
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);
 
366
};
 
367
 
 
368
 
 
369
/*************************************************************************
 
370
  Miscellaneous functions for plugin implementors
 
371
*/
 
372
 
 
373
#ifdef __cplusplus
 
374
extern "C" {
 
375
#endif
 
376
 
 
377
extern bool plugin_init(plugin::Registry &registry,
 
378
                        int *argc, char **argv,
 
379
                        bool skip_init);
 
380
extern void plugin_shutdown(plugin::Registry &plugins);
 
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
 
 
387
int session_in_lock_tables(const Session *session);
 
388
int session_tablespace_op(const Session *session);
 
389
void set_session_proc_info(Session *session, const char *info);
 
390
const char *get_session_proc_info(Session *session);
 
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);
 
394
 
 
395
 
 
396
 
 
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
 
407
  @retval >= 0  a file handle that can be passed to dup or internal::my_close
 
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
 
 
421
  @param session  user thread connection handle
 
422
  @retval 0  the connection is active
 
423
  @retval 1  the connection has been killed
 
424
*/
 
425
int session_killed(const Session *session);
 
426
 
 
427
 
 
428
/**
 
429
  Return the thread id of a user thread
 
430
 
 
431
  @param session  user thread connection handle
 
432
  @return  thread id
 
433
*/
 
434
unsigned long session_get_thread_id(const Session *session);
 
435
 
 
436
const charset_info_st *session_charset(Session *session);
 
437
int session_non_transactional_update(const Session *session);
 
438
void session_mark_transaction_to_rollback(Session *session, bool all);
 
439
 
 
440
 
 
441
/**
 
442
  Allocate memory in the connection's local memory pool
 
443
 
 
444
  @details
 
445
  When properly used in place of @c malloc(), this can significantly
 
446
  improve concurrency. Don't use this or related functions to allocate
 
447
  large chunks of memory. Use for temporary storage only. The memory
 
448
  will be freed automatically at the end of the statement; no explicit
 
449
  code is required to prevent memory leaks.
 
450
 
 
451
  @see alloc_root()
 
452
*/
 
453
void *session_alloc(Session *session, unsigned int size);
 
454
/**
 
455
  @see session_alloc()
 
456
*/
 
457
void *session_calloc(Session *session, unsigned int size);
 
458
/**
 
459
  @see session_alloc()
 
460
*/
 
461
char *session_strdup(Session *session, const char *str);
 
462
/**
 
463
  @see session_alloc()
 
464
*/
 
465
char *session_strmake(Session *session, const char *str, unsigned int size);
 
466
/**
 
467
  @see session_alloc()
 
468
*/
 
469
void *session_memdup(Session *session, const void* str, unsigned int size);
 
470
 
 
471
/**
 
472
  Get the XID for this connection's transaction
 
473
 
 
474
  @param session  user thread connection handle
 
475
  @param xid  location where identifier is stored
 
476
*/
 
477
void session_get_xid(const Session *session, DRIZZLE_XID *xid);
 
478
 
 
479
/**
 
480
  Invalidate the query cache for a given table.
 
481
 
 
482
  @param session         user thread connection handle
 
483
  @param key         databasename\\0tablename\\0
 
484
  @param key_length  length of key in bytes, including the NUL bytes
 
485
  @param using_trx   flag: TRUE if using transactions, FALSE otherwise
 
486
*/
 
487
void mysql_query_cache_invalidate4(Session *session,
 
488
                                   const char *key, unsigned int key_length,
 
489
                                   int using_trx);
 
490
 
 
491
#ifdef __cplusplus
 
492
}
 
493
#endif
 
494
 
 
495
} /* namespace drizzled */
 
496
 
 
497
#endif /* DRIZZLED_PLUGIN_H */
 
498