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