1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
|
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
* Copyright (C) 2008 Sun Microsystems
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef DRIZZLED_PLUGIN_H
#define DRIZZLED_PLUGIN_H
#include <drizzled/global.h>
#include <drizzled/lex_string.h>
#include <drizzled/xid.h>
class Session;
class Item;
/*************************************************************************
Plugin API. Common for all plugin types.
*/
/*
The allowable types of plugins
*/
enum drizzle_plugin_type {
DRIZZLE_DAEMON_PLUGIN, /* Daemon / Raw */
DRIZZLE_STORAGE_ENGINE_PLUGIN, /* Storage Engine */
DRIZZLE_INFORMATION_SCHEMA_PLUGIN, /* Information Schema */
DRIZZLE_UDF_PLUGIN, /* User-Defined Function */
DRIZZLE_UDA_PLUGIN, /* User-Defined Aggregate Function */
DRIZZLE_AUDIT_PLUGIN, /* Audit */
DRIZZLE_LOGGER_PLUGIN, /* Query Logging */
DRIZZLE_ERRMSG_PLUGIN, /* Error Messages */
DRIZZLE_AUTH_PLUGIN, /* Authorization */
DRIZZLE_CONFIGVAR_PLUGIN, /* Configuration Variables */
DRIZZLE_QCACHE_PLUGIN, /* Query Cache */
DRIZZLE_PARSER_PLUGIN, /* Language Parser */
DRIZZLE_SCHEDULING_PLUGIN, /* Thread and Session Scheduling */
DRIZZLE_REPLICATOR_PLUGIN, /* Database Replication */
DRIZZLE_PLUGIN_MAX=DRIZZLE_REPLICATOR_PLUGIN
};
/* The number of plugin types */
const uint32_t DRIZZLE_MAX_PLUGIN_TYPE_NUM=DRIZZLE_PLUGIN_MAX+1;
/* We use the following strings to define licenses for plugins */
enum plugin_license_type {
PLUGIN_LICENSE_PROPRIETARY,
PLUGIN_LICENSE_GPL,
PLUGIN_LICENSE_BSD,
PLUGIN_LICENSE_LGPL,
PLUGIN_LICENSE_MAX=PLUGIN_LICENSE_LGPL
};
const char * const PLUGIN_LICENSE_PROPRIETARY_STRING="PROPRIETARY";
const char * const PLUGIN_LICENSE_GPL_STRING="GPL";
const char * const PLUGIN_LICENSE_BSD_STRING="BSD";
const char * const PLUGIN_LICENSE_LGPL_STRING="LGPL";
/*
Macros for beginning and ending plugin declarations. Between
drizzle_declare_plugin and drizzle_declare_plugin_end there should
be a st_mysql_plugin struct for each plugin to be declared.
*/
#ifndef DRIZZLE_DYNAMIC_PLUGIN
#define __DRIZZLE_DECLARE_PLUGIN(NAME, DECLS) \
struct st_mysql_plugin DECLS[]= {
#else
#define __DRIZZLE_DECLARE_PLUGIN(NAME, DECLS) \
struct st_mysql_plugin _mysql_plugin_declarations_[]= {
#endif
#define drizzle_declare_plugin(NAME) \
__DRIZZLE_DECLARE_PLUGIN(NAME, \
builtin_ ## NAME ## _plugin)
#define drizzle_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0}}
/*
declarations for SHOW STATUS support in plugins
*/
enum enum_mysql_show_type
{
SHOW_UNDEF, SHOW_BOOL, SHOW_INT, SHOW_LONG,
SHOW_LONGLONG, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE, SHOW_SIZE
};
struct st_mysql_show_var {
const char *name;
char *value;
enum enum_mysql_show_type type;
};
#define SHOW_VAR_FUNC_BUFF_SIZE 1024
typedef int (*mysql_show_var_func)(Session *, struct st_mysql_show_var *, char *);
struct st_show_var_func_container {
mysql_show_var_func func;
};
/*
declarations for server variables and command line options
*/
#define PLUGIN_VAR_BOOL 0x0001
#define PLUGIN_VAR_INT 0x0002
#define PLUGIN_VAR_LONG 0x0003
#define PLUGIN_VAR_LONGLONG 0x0004
#define PLUGIN_VAR_STR 0x0005
#define PLUGIN_VAR_ENUM 0x0006
#define PLUGIN_VAR_SET 0x0007
#define PLUGIN_VAR_UNSIGNED 0x0080
#define PLUGIN_VAR_SessionLOCAL 0x0100 /* Variable is per-connection */
#define PLUGIN_VAR_READONLY 0x0200 /* Server variable is read only */
#define PLUGIN_VAR_NOSYSVAR 0x0400 /* Not a server variable */
#define PLUGIN_VAR_NOCMDOPT 0x0800 /* Not a command line option */
#define PLUGIN_VAR_NOCMDARG 0x1000 /* No argument for cmd line */
#define PLUGIN_VAR_RQCMDARG 0x0000 /* Argument required for cmd line */
#define PLUGIN_VAR_OPCMDARG 0x2000 /* Argument optional for cmd line */
#define PLUGIN_VAR_MEMALLOC 0x8000 /* String needs memory allocated */
struct st_mysql_sys_var;
struct st_mysql_value;
/*
SYNOPSIS
(*mysql_var_check_func)()
session thread handle
var dynamic variable being altered
save pointer to temporary storage
value user provided value
RETURN
0 user provided value is OK and the update func may be called.
any other value indicates error.
This function should parse the user provided value and store in the
provided temporary storage any data as required by the update func.
There is sufficient space in the temporary storage to store a double.
Note that the update func may not be called if any other error occurs
so any memory allocated should be thread-local so that it may be freed
automatically at the end of the statement.
*/
typedef int (*mysql_var_check_func)(Session *session,
struct st_mysql_sys_var *var,
void *save, struct st_mysql_value *value);
/*
SYNOPSIS
(*mysql_var_update_func)()
session thread handle
var dynamic variable being altered
var_ptr pointer to dynamic variable
save pointer to temporary storage
RETURN
NONE
This function should use the validated value stored in the temporary store
and persist it in the provided pointer to the dynamic variable.
For example, strings may require memory to be allocated.
*/
typedef void (*mysql_var_update_func)(Session *session,
struct st_mysql_sys_var *var,
void *var_ptr, const void *save);
/* the following declarations are for internal use only */
#define PLUGIN_VAR_MASK \
(PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | \
PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC)
#define DRIZZLE_PLUGIN_VAR_HEADER \
int flags; \
const char *name; \
const char *comment; \
mysql_var_check_func check; \
mysql_var_update_func update
#define DRIZZLE_SYSVAR_NAME(name) mysql_sysvar_ ## name
#define DRIZZLE_SYSVAR(name) \
((struct st_mysql_sys_var *)&(DRIZZLE_SYSVAR_NAME(name)))
/*
for global variables, the value pointer is the first
element after the header, the default value is the second.
for thread variables, the value offset is the first
element after the header, the default value is the second.
*/
#define DECLARE_DRIZZLE_SYSVAR_BASIC(name, type) struct { \
DRIZZLE_PLUGIN_VAR_HEADER; \
type *value; \
const type def_val; \
} DRIZZLE_SYSVAR_NAME(name)
#define DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, type) struct { \
DRIZZLE_PLUGIN_VAR_HEADER; \
type *value; type def_val; \
type min_val; type max_val; \
type blk_sz; \
} DRIZZLE_SYSVAR_NAME(name)
#define DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, type) struct { \
DRIZZLE_PLUGIN_VAR_HEADER; \
type *value; type def_val; \
TYPELIB *typelib; \
} DRIZZLE_SYSVAR_NAME(name)
#define DECLARE_SessionVAR_FUNC(type) \
type *(*resolve)(Session *session, int offset)
#define DECLARE_DRIZZLE_SessionVAR_BASIC(name, type) struct { \
DRIZZLE_PLUGIN_VAR_HEADER; \
int offset; \
const type def_val; \
DECLARE_SessionVAR_FUNC(type); \
} DRIZZLE_SYSVAR_NAME(name)
#define DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, type) struct { \
DRIZZLE_PLUGIN_VAR_HEADER; \
int offset; \
type def_val; type min_val; \
type max_val; type blk_sz; \
DECLARE_SessionVAR_FUNC(type); \
} DRIZZLE_SYSVAR_NAME(name)
#define DECLARE_DRIZZLE_SessionVAR_TYPELIB(name, type) struct { \
DRIZZLE_PLUGIN_VAR_HEADER; \
int offset; \
type def_val; \
DECLARE_SessionVAR_FUNC(type); \
TYPELIB *typelib; \
} DRIZZLE_SYSVAR_NAME(name)
/*
the following declarations are for use by plugin implementors
*/
#define DRIZZLE_SYSVAR_BOOL(name, varname, opt, comment, check, update, def) \
DECLARE_DRIZZLE_SYSVAR_BASIC(name, bool) = { \
PLUGIN_VAR_BOOL | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def}
#define DRIZZLE_SYSVAR_STR(name, varname, opt, comment, check, update, def) \
DECLARE_DRIZZLE_SYSVAR_BASIC(name, char *) = { \
PLUGIN_VAR_STR | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def}
#define DRIZZLE_SYSVAR_INT(name, varname, opt, comment, check, update, def, min, max, blk) \
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, int) = { \
PLUGIN_VAR_INT | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, min, max, blk }
#define DRIZZLE_SYSVAR_UINT(name, varname, opt, comment, check, update, def, min, max, blk) \
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, unsigned int) = { \
PLUGIN_VAR_INT | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, min, max, blk }
#define DRIZZLE_SYSVAR_LONG(name, varname, opt, comment, check, update, def, min, max, blk) \
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, long) = { \
PLUGIN_VAR_LONG | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, min, max, blk }
#define DRIZZLE_SYSVAR_ULONG(name, varname, opt, comment, check, update, def, min, max, blk) \
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, unsigned long) = { \
PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, min, max, blk }
#define DRIZZLE_SYSVAR_LONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, int64_t) = { \
PLUGIN_VAR_LONGLONG | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, min, max, blk }
#define DRIZZLE_SYSVAR_ULONGLONG(name, varname, opt, comment, check, update, def, min, max, blk) \
DECLARE_DRIZZLE_SYSVAR_SIMPLE(name, uint64_t) = { \
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, min, max, blk }
#define DRIZZLE_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, unsigned long) = { \
PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, typelib }
#define DRIZZLE_SYSVAR_SET(name, varname, opt, comment, check, update, def, typelib) \
DECLARE_DRIZZLE_SYSVAR_TYPELIB(name, uint64_t) = { \
PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, typelib }
#define DRIZZLE_SessionVAR_BOOL(name, opt, comment, check, update, def) \
DECLARE_DRIZZLE_SessionVAR_BASIC(name, char) = { \
PLUGIN_VAR_BOOL | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, -1, def, NULL}
#define DRIZZLE_SessionVAR_STR(name, opt, comment, check, update, def) \
DECLARE_DRIZZLE_SessionVAR_BASIC(name, char *) = { \
PLUGIN_VAR_STR | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, -1, def, NULL}
#define DRIZZLE_SessionVAR_INT(name, opt, comment, check, update, def, min, max, blk) \
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, int) = { \
PLUGIN_VAR_INT | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, -1, def, min, max, blk, NULL }
#define DRIZZLE_SessionVAR_UINT(name, opt, comment, check, update, def, min, max, blk) \
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, unsigned int) = { \
PLUGIN_VAR_INT | PLUGIN_VAR_SessionLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, -1, def, min, max, blk, NULL }
#define DRIZZLE_SessionVAR_LONG(name, opt, comment, check, update, def, min, max, blk) \
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, long) = { \
PLUGIN_VAR_LONG | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, -1, def, min, max, blk, NULL }
#define DRIZZLE_SessionVAR_ULONG(name, opt, comment, check, update, def, min, max, blk) \
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, unsigned long) = { \
PLUGIN_VAR_LONG | PLUGIN_VAR_SessionLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, -1, def, min, max, blk, NULL }
#define DRIZZLE_SessionVAR_LONGLONG(name, opt, comment, check, update, def, min, max, blk) \
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, int64_t) = { \
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, -1, def, min, max, blk, NULL }
#define DRIZZLE_SessionVAR_ULONGLONG(name, opt, comment, check, update, def, min, max, blk) \
DECLARE_DRIZZLE_SessionVAR_SIMPLE(name, uint64_t) = { \
PLUGIN_VAR_LONGLONG | PLUGIN_VAR_SessionLOCAL | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, -1, def, min, max, blk, NULL }
#define DRIZZLE_SessionVAR_ENUM(name, opt, comment, check, update, def, typelib) \
DECLARE_DRIZZLE_SessionVAR_TYPELIB(name, unsigned long) = { \
PLUGIN_VAR_ENUM | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, -1, def, NULL, typelib }
#define DRIZZLE_SessionVAR_SET(name, opt, comment, check, update, def, typelib) \
DECLARE_DRIZZLE_SessionVAR_TYPELIB(name, uint64_t) = { \
PLUGIN_VAR_SET | PLUGIN_VAR_SessionLOCAL | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, -1, def, NULL, typelib }
/* accessor macros */
#define SYSVAR(name) \
(*(DRIZZLE_SYSVAR_NAME(name).value))
/* when session == null, result points to global value */
#define SessionVAR(session, name) \
(*(DRIZZLE_SYSVAR_NAME(name).resolve(session, DRIZZLE_SYSVAR_NAME(name).offset)))
/*
Plugin description structure.
*/
struct st_mysql_plugin
{
uint32_t type; /* the plugin type (a DRIZZLE_XXX_PLUGIN value) */
const char *name; /* plugin name (for SHOW PLUGINS) */
const char *version; /* plugin version (for SHOW PLUGINS) */
const char *author; /* plugin author (for SHOW PLUGINS) */
const char *descr; /* general descriptive text (for SHOW PLUGINS ) */
int license; /* the plugin license (PLUGIN_LICENSE_XXX) */
int (*init)(void *); /* the function to invoke when plugin is loaded */
int (*deinit)(void *);/* the function to invoke when plugin is unloaded */
struct st_mysql_show_var *status_vars;
struct st_mysql_sys_var **system_vars;
void *reserved1; /* reserved for dependency checking */
};
struct handlerton;
class Plugin
{
private:
std::string name;
std::string version;
std::string author;
std::string description;
public:
Plugin(std::string in_name, std::string in_version,
std::string in_author, std::string in_description)
: name(in_name), version(in_version),
author(in_author), description(in_description)
{}
virtual ~Plugin() {}
virtual void add_functions() {}
};
/*************************************************************************
st_mysql_value struct for reading values from mysqld.
Used by server variables framework to parse user-provided values.
Will be used for arguments when implementing UDFs.
Note that val_str() returns a string in temporary memory
that will be freed at the end of statement. Copy the string
if you need it to persist.
*/
#define DRIZZLE_VALUE_TYPE_STRING 0
#define DRIZZLE_VALUE_TYPE_REAL 1
#define DRIZZLE_VALUE_TYPE_INT 2
struct st_mysql_value
{
int (*value_type)(struct st_mysql_value *);
const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
int (*val_real)(struct st_mysql_value *, double *realbuf);
int (*val_int)(struct st_mysql_value *, int64_t *intbuf);
};
/*************************************************************************
Miscellaneous functions for plugin implementors
*/
#ifdef __cplusplus
extern "C" {
#endif
int session_in_lock_tables(const Session *session);
int session_tablespace_op(const Session *session);
void set_session_proc_info(Session *session, const char *info);
const char *get_session_proc_info(Session *session);
int64_t session_test_options(const Session *session, int64_t test_options);
int session_sql_command(const Session *session);
void **session_ha_data(const Session *session, const struct handlerton *hton);
int session_tx_isolation(const Session *session);
/* Increments the row counter, see Session::row_count */
void session_inc_row_count(Session *session);
LEX_STRING *session_make_lex_string(Session *session, LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
/**
Create a temporary file.
@details
The temporary file is created in a location specified by the mysql
server configuration (--tmpdir option). The caller does not need to
delete the file, it will be deleted automatically.
@param prefix prefix for temporary file name
@retval -1 error
@retval >= 0 a file handle that can be passed to dup or my_close
*/
int mysql_tmpfile(const char *prefix);
/**
Check the killed state of a connection
@details
In MySQL support for the KILL statement is cooperative. The KILL
statement only sets a "killed" flag. This function returns the value
of that flag. A thread should check it often, especially inside
time-consuming loops, and gracefully abort the operation if it is
non-zero.
@param session user thread connection handle
@retval 0 the connection is active
@retval 1 the connection has been killed
*/
int session_killed(const Session *session);
/**
Return the thread id of a user thread
@param session user thread connection handle
@return thread id
*/
unsigned long session_get_thread_id(const Session *session);
/**
Allocate memory in the connection's local memory pool
@details
When properly used in place of @c malloc(), this can significantly
improve concurrency. Don't use this or related functions to allocate
large chunks of memory. Use for temporary storage only. The memory
will be freed automatically at the end of the statement; no explicit
code is required to prevent memory leaks.
@see alloc_root()
*/
void *session_alloc(Session *session, unsigned int size);
/**
@see session_alloc()
*/
void *session_calloc(Session *session, unsigned int size);
/**
@see session_alloc()
*/
char *session_strdup(Session *session, const char *str);
/**
@see session_alloc()
*/
char *session_strmake(Session *session, const char *str, unsigned int size);
/**
@see session_alloc()
*/
void *session_memdup(Session *session, const void* str, unsigned int size);
/**
Get the XID for this connection's transaction
@param session user thread connection handle
@param xid location where identifier is stored
*/
void session_get_xid(const Session *session, DRIZZLE_XID *xid);
/**
Invalidate the query cache for a given table.
@param session user thread connection handle
@param key databasename\\0tablename\\0
@param key_length length of key in bytes, including the NUL bytes
@param using_trx flag: TRUE if using transactions, FALSE otherwise
*/
void mysql_query_cache_invalidate4(Session *session,
const char *key, unsigned int key_length,
int using_trx);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
/**
Provide a handler data getter to simplify coding
*/
inline
void *
session_get_ha_data(const Session *session, const struct handlerton *hton)
{
return *session_ha_data(session, hton);
}
/**
Provide a handler data setter to simplify coding
*/
inline
void
session_set_ha_data(const Session *session, const struct handlerton *hton,
const void *ha_data)
{
*session_ha_data(session, hton)= (void*) ha_data;
}
#endif
#endif /* _my_plugin_h */
|