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