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