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