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