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