1
by brian
clean slate |
1 |
/* Copyright (C) 2002-2006 MySQL AB
|
2 |
||
3 |
This program is free software; you can redistribute it and/or modify
|
|
4 |
it under the terms of the GNU General Public License as published by
|
|
5 |
the Free Software Foundation; version 2 of the License.
|
|
6 |
||
7 |
This program is distributed in the hope that it will be useful,
|
|
8 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10 |
GNU General Public License for more details.
|
|
11 |
||
12 |
You should have received a copy of the GNU General Public License
|
|
13 |
along with this program; if not, write to the Free Software
|
|
14 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
15 |
||
16 |
/* Classes to support the SET command */
|
|
17 |
||
18 |
#ifdef USE_PRAGMA_INTERFACE
|
|
19 |
#pragma interface /* gcc class implementation */ |
|
20 |
#endif
|
|
21 |
||
22 |
/****************************************************************************
|
|
23 |
Variables that are changable runtime are declared using the
|
|
24 |
following classes
|
|
25 |
****************************************************************************/
|
|
26 |
||
27 |
class sys_var; |
|
28 |
class set_var; |
|
29 |
class sys_var_pluginvar; /* opaque */ |
|
30 |
typedef struct system_variables SV; |
|
31 |
typedef struct my_locale_st MY_LOCALE; |
|
32 |
||
33 |
extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib, |
|
34 |
optimizer_switch_typelib, slave_exec_mode_typelib; |
|
35 |
||
36 |
typedef int (*sys_check_func)(THD *, set_var *); |
|
37 |
typedef bool (*sys_update_func)(THD *, set_var *); |
|
38 |
typedef void (*sys_after_update_func)(THD *,enum_var_type); |
|
39 |
typedef void (*sys_set_default_func)(THD *, enum_var_type); |
|
40 |
typedef uchar *(*sys_value_ptr_func)(THD *thd); |
|
41 |
||
42 |
struct sys_var_chain |
|
43 |
{
|
|
44 |
sys_var *first; |
|
45 |
sys_var *last; |
|
46 |
};
|
|
47 |
||
48 |
class sys_var |
|
49 |
{
|
|
50 |
public: |
|
51 |
||
52 |
/**
|
|
53 |
Enumeration type to indicate for a system variable whether it will be written to the binlog or not.
|
|
54 |
*/
|
|
55 |
enum Binlog_status_enum |
|
56 |
{
|
|
57 |
/* The variable value is not in the binlog. */
|
|
58 |
NOT_IN_BINLOG, |
|
59 |
/* The value of the @@session variable is in the binlog. */
|
|
60 |
SESSION_VARIABLE_IN_BINLOG
|
|
61 |
/*
|
|
62 |
Currently, no @@global variable is ever in the binlog, so we
|
|
63 |
don't need an enumeration value for that.
|
|
64 |
*/
|
|
65 |
};
|
|
66 |
||
67 |
sys_var *next; |
|
68 |
struct my_option *option_limits; /* Updated by by set_var_init() */ |
|
69 |
uint name_length; /* Updated by by set_var_init() */ |
|
70 |
const char *name; |
|
71 |
||
72 |
sys_after_update_func after_update; |
|
73 |
bool no_support_one_shot; |
|
74 |
sys_var(const char *name_arg, sys_after_update_func func= NULL, |
|
75 |
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG) |
|
76 |
:name(name_arg), after_update(func), no_support_one_shot(1), |
|
77 |
binlog_status(binlog_status_arg), |
|
51.1.46
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
78 |
m_allow_empty_value(true) |
1
by brian
clean slate |
79 |
{}
|
80 |
virtual ~sys_var() {} |
|
81 |
void chain_sys_var(sys_var_chain *chain_arg) |
|
82 |
{
|
|
83 |
if (chain_arg->last) |
|
84 |
chain_arg->last->next= this; |
|
85 |
else
|
|
86 |
chain_arg->first= this; |
|
87 |
chain_arg->last= this; |
|
88 |
}
|
|
89 |
virtual bool check(THD *thd, set_var *var); |
|
90 |
bool check_enum(THD *thd, set_var *var, const TYPELIB *enum_names); |
|
91 |
bool check_set(THD *thd, set_var *var, TYPELIB *enum_names); |
|
92 |
bool is_written_to_binlog(enum_var_type type) |
|
93 |
{
|
|
94 |
return (type == OPT_SESSION || type == OPT_DEFAULT) && |
|
95 |
(binlog_status == SESSION_VARIABLE_IN_BINLOG); |
|
96 |
}
|
|
97 |
virtual bool update(THD *thd, set_var *var)=0; |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
98 |
virtual void set_default(THD *thd_arg __attribute__((unused)), |
99 |
enum_var_type type __attribute__((unused))) |
|
77.1.7
by Monty Taylor
Heap builds clean. |
100 |
{}
|
1
by brian
clean slate |
101 |
virtual SHOW_TYPE show_type() { return SHOW_UNDEF; } |
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
102 |
virtual uchar *value_ptr(THD *thd __attribute__((unused)), |
103 |
enum_var_type type __attribute__((unused)), |
|
104 |
LEX_STRING *base __attribute__((unused))) |
|
1
by brian
clean slate |
105 |
{ return 0; } |
106 |
virtual bool check_type(enum_var_type type) |
|
107 |
{ return type != OPT_GLOBAL; } /* Error if not GLOBAL */ |
|
108 |
virtual bool check_update_type(Item_result type) |
|
109 |
{ return type != INT_RESULT; } /* Assume INT */ |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
110 |
virtual bool check_default(enum_var_type type __attribute__((unused))) |
1
by brian
clean slate |
111 |
{ return option_limits == 0; } |
112 |
Item *item(THD *thd, enum_var_type type, LEX_STRING *base); |
|
113 |
virtual bool is_struct() { return 0; } |
|
114 |
virtual bool is_readonly() const { return 0; } |
|
115 |
virtual sys_var_pluginvar *cast_pluginvar() { return 0; } |
|
116 |
||
117 |
protected: |
|
118 |
void set_allow_empty_value(bool allow_empty_value) |
|
119 |
{
|
|
120 |
m_allow_empty_value= allow_empty_value; |
|
121 |
}
|
|
122 |
||
123 |
private: |
|
124 |
const Binlog_status_enum binlog_status; |
|
125 |
||
126 |
bool m_allow_empty_value; |
|
127 |
};
|
|
128 |
||
129 |
||
130 |
/*
|
|
131 |
A base class for all variables that require its access to
|
|
132 |
be guarded with a mutex.
|
|
133 |
*/
|
|
134 |
||
135 |
class sys_var_global: public sys_var |
|
136 |
{
|
|
137 |
protected: |
|
138 |
pthread_mutex_t *guard; |
|
139 |
public: |
|
140 |
sys_var_global(const char *name_arg, sys_after_update_func after_update_arg, |
|
141 |
pthread_mutex_t *guard_arg) |
|
142 |
:sys_var(name_arg, after_update_arg), guard(guard_arg) {} |
|
143 |
};
|
|
144 |
||
145 |
||
146 |
/*
|
|
147 |
A global-only ulong variable that requires its access to be
|
|
148 |
protected with a mutex.
|
|
149 |
*/
|
|
150 |
||
151 |
class sys_var_long_ptr_global: public sys_var_global |
|
152 |
{
|
|
10
by Brian Aker
Start of var cleanup (really.... looking at this code the entire thing needs |
153 |
ulong *value; |
1
by brian
clean slate |
154 |
public: |
155 |
sys_var_long_ptr_global(sys_var_chain *chain, const char *name_arg, |
|
156 |
ulong *value_ptr_arg, |
|
157 |
pthread_mutex_t *guard_arg, |
|
158 |
sys_after_update_func after_update_arg= NULL) |
|
159 |
:sys_var_global(name_arg, after_update_arg, guard_arg), |
|
160 |
value(value_ptr_arg) |
|
161 |
{ chain_sys_var(chain); } |
|
162 |
bool check(THD *thd, set_var *var); |
|
163 |
bool update(THD *thd, set_var *var); |
|
164 |
void set_default(THD *thd, enum_var_type type); |
|
165 |
SHOW_TYPE show_type() { return SHOW_LONG; } |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
166 |
uchar *value_ptr(THD *thd __attribute__((unused)), |
167 |
enum_var_type type __attribute__((unused)), |
|
168 |
LEX_STRING *base __attribute__((unused))) |
|
1
by brian
clean slate |
169 |
{ return (uchar*) value; } |
170 |
};
|
|
171 |
||
172 |
||
173 |
/*
|
|
174 |
A global ulong variable that is protected by LOCK_global_system_variables
|
|
175 |
*/
|
|
176 |
||
177 |
class sys_var_long_ptr :public sys_var_long_ptr_global |
|
178 |
{
|
|
179 |
public: |
|
180 |
sys_var_long_ptr(sys_var_chain *chain, const char *name_arg, ulong *value_ptr, |
|
181 |
sys_after_update_func after_update_arg= NULL); |
|
182 |
};
|
|
183 |
||
184 |
||
151
by Brian Aker
Ulonglong to uint64_t |
185 |
class sys_var_uint64_t_ptr :public sys_var |
1
by brian
clean slate |
186 |
{
|
151
by Brian Aker
Ulonglong to uint64_t |
187 |
uint64_t *value; |
10
by Brian Aker
Start of var cleanup (really.... looking at this code the entire thing needs |
188 |
public: |
151
by Brian Aker
Ulonglong to uint64_t |
189 |
sys_var_uint64_t_ptr(sys_var_chain *chain, const char *name_arg, uint64_t *value_ptr_arg) |
1
by brian
clean slate |
190 |
:sys_var(name_arg),value(value_ptr_arg) |
191 |
{ chain_sys_var(chain); } |
|
151
by Brian Aker
Ulonglong to uint64_t |
192 |
sys_var_uint64_t_ptr(sys_var_chain *chain, const char *name_arg, uint64_t *value_ptr_arg, |
1
by brian
clean slate |
193 |
sys_after_update_func func) |
194 |
:sys_var(name_arg,func), value(value_ptr_arg) |
|
195 |
{ chain_sys_var(chain); } |
|
196 |
bool update(THD *thd, set_var *var); |
|
197 |
void set_default(THD *thd, enum_var_type type); |
|
198 |
SHOW_TYPE show_type() { return SHOW_LONGLONG; } |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
199 |
uchar *value_ptr(THD *thd __attribute__((unused)), |
200 |
enum_var_type type __attribute__((unused)), |
|
201 |
LEX_STRING *base __attribute__((unused))) |
|
1
by brian
clean slate |
202 |
{ return (uchar*) value; } |
203 |
};
|
|
204 |
||
205 |
||
206 |
class sys_var_bool_ptr :public sys_var |
|
207 |
{
|
|
208 |
public: |
|
146
by Brian Aker
my_bool cleanup. |
209 |
bool *value; |
147
by Brian Aker
More my_bool conversion. This time the set_var class. |
210 |
sys_var_bool_ptr(sys_var_chain *chain, const char *name_arg, bool *value_arg) |
146
by Brian Aker
my_bool cleanup. |
211 |
:sys_var(name_arg),value(value_arg) |
212 |
{ chain_sys_var(chain); } |
|
213 |
bool check(THD *thd, set_var *var) |
|
214 |
{
|
|
215 |
return check_enum(thd, var, &bool_typelib); |
|
216 |
}
|
|
217 |
bool update(THD *thd, set_var *var); |
|
218 |
void set_default(THD *thd, enum_var_type type); |
|
219 |
SHOW_TYPE show_type() { return SHOW_MY_BOOL; } |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
220 |
uchar *value_ptr(THD *thd __attribute__((unused)), |
221 |
enum_var_type type __attribute__((unused)), |
|
222 |
LEX_STRING *base __attribute__((unused))) |
|
146
by Brian Aker
my_bool cleanup. |
223 |
{ return (uchar*) value; } |
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
224 |
bool check_update_type(Item_result type __attribute__((unused))) |
146
by Brian Aker
my_bool cleanup. |
225 |
{ return 0; } |
226 |
};
|
|
227 |
||
1
by brian
clean slate |
228 |
class sys_var_bool_ptr_readonly :public sys_var_bool_ptr |
229 |
{
|
|
230 |
public: |
|
231 |
sys_var_bool_ptr_readonly(sys_var_chain *chain, const char *name_arg, |
|
147
by Brian Aker
More my_bool conversion. This time the set_var class. |
232 |
bool *value_arg) |
1
by brian
clean slate |
233 |
:sys_var_bool_ptr(chain, name_arg, value_arg) |
234 |
{}
|
|
235 |
bool is_readonly() const { return 1; } |
|
236 |
};
|
|
237 |
||
238 |
||
239 |
class sys_var_str :public sys_var |
|
240 |
{
|
|
241 |
public: |
|
242 |
char *value; // Pointer to allocated string |
|
243 |
uint value_length; |
|
244 |
sys_check_func check_func; |
|
245 |
sys_update_func update_func; |
|
246 |
sys_set_default_func set_default_func; |
|
247 |
sys_var_str(sys_var_chain *chain, const char *name_arg, |
|
248 |
sys_check_func check_func_arg, |
|
249 |
sys_update_func update_func_arg, |
|
250 |
sys_set_default_func set_default_func_arg, |
|
251 |
char *value_arg) |
|
252 |
:sys_var(name_arg), value(value_arg), check_func(check_func_arg), |
|
253 |
update_func(update_func_arg),set_default_func(set_default_func_arg) |
|
254 |
{ chain_sys_var(chain); } |
|
255 |
bool check(THD *thd, set_var *var); |
|
256 |
bool update(THD *thd, set_var *var) |
|
257 |
{
|
|
258 |
return (*update_func)(thd, var); |
|
259 |
}
|
|
260 |
void set_default(THD *thd, enum_var_type type) |
|
261 |
{
|
|
262 |
(*set_default_func)(thd, type); |
|
263 |
}
|
|
264 |
SHOW_TYPE show_type() { return SHOW_CHAR; } |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
265 |
uchar *value_ptr(THD *thd __attribute__((unused)), |
266 |
enum_var_type type __attribute__((unused)), |
|
267 |
LEX_STRING *base __attribute__((unused))) |
|
1
by brian
clean slate |
268 |
{ return (uchar*) value; } |
269 |
bool check_update_type(Item_result type) |
|
270 |
{
|
|
271 |
return type != STRING_RESULT; /* Only accept strings */ |
|
272 |
}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
273 |
bool check_default(enum_var_type type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
274 |
{ return 0; } |
1
by brian
clean slate |
275 |
};
|
276 |
||
277 |
||
278 |
class sys_var_const_str :public sys_var |
|
279 |
{
|
|
280 |
char *value; // Pointer to const value |
|
10
by Brian Aker
Start of var cleanup (really.... looking at this code the entire thing needs |
281 |
public: |
1
by brian
clean slate |
282 |
sys_var_const_str(sys_var_chain *chain, const char *name_arg, |
283 |
const char *value_arg) |
|
284 |
:sys_var(name_arg), value((char*) value_arg) |
|
285 |
{ chain_sys_var(chain); } |
|
10
by Brian Aker
Start of var cleanup (really.... looking at this code the entire thing needs |
286 |
inline void set (char *new_value) |
287 |
{
|
|
288 |
value= new_value; |
|
289 |
}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
290 |
bool check(THD *thd __attribute__((unused)), |
291 |
set_var *var __attribute__((unused))) |
|
1
by brian
clean slate |
292 |
{
|
293 |
return 1; |
|
294 |
}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
295 |
bool update(THD *thd __attribute__((unused)), |
296 |
set_var *var __attribute__((unused))) |
|
1
by brian
clean slate |
297 |
{
|
298 |
return 1; |
|
299 |
}
|
|
300 |
SHOW_TYPE show_type() { return SHOW_CHAR; } |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
301 |
uchar *value_ptr(THD *thd __attribute__((unused)), |
302 |
enum_var_type type __attribute__((unused)), |
|
303 |
LEX_STRING *base __attribute__((unused))) |
|
1
by brian
clean slate |
304 |
{
|
305 |
return (uchar*) value; |
|
306 |
}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
307 |
bool check_update_type(Item_result type __attribute__((unused))) |
1
by brian
clean slate |
308 |
{
|
309 |
return 1; |
|
310 |
}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
311 |
bool check_default(enum_var_type type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
312 |
{ return 1; } |
1
by brian
clean slate |
313 |
bool is_readonly() const { return 1; } |
314 |
};
|
|
315 |
||
316 |
||
317 |
class sys_var_const_str_ptr :public sys_var |
|
318 |
{
|
|
319 |
char **value; // Pointer to const value |
|
10
by Brian Aker
Start of var cleanup (really.... looking at this code the entire thing needs |
320 |
public: |
1
by brian
clean slate |
321 |
sys_var_const_str_ptr(sys_var_chain *chain, const char *name_arg, char **value_arg) |
322 |
:sys_var(name_arg),value(value_arg) |
|
323 |
{ chain_sys_var(chain); } |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
324 |
bool check(THD *thd __attribute__((unused)), |
325 |
set_var *var __attribute__((unused))) |
|
1
by brian
clean slate |
326 |
{
|
327 |
return 1; |
|
328 |
}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
329 |
bool update(THD *thd __attribute__((unused)), |
330 |
set_var *var __attribute__((unused))) |
|
1
by brian
clean slate |
331 |
{
|
332 |
return 1; |
|
333 |
}
|
|
334 |
SHOW_TYPE show_type() { return SHOW_CHAR; } |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
335 |
uchar *value_ptr(THD *thd __attribute__((unused)), |
336 |
enum_var_type type __attribute__((unused)), |
|
337 |
LEX_STRING *base __attribute__((unused))) |
|
1
by brian
clean slate |
338 |
{
|
339 |
return (uchar*) *value; |
|
340 |
}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
341 |
bool check_update_type(Item_result type __attribute__((unused))) |
1
by brian
clean slate |
342 |
{
|
343 |
return 1; |
|
344 |
}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
345 |
bool check_default(enum_var_type type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
346 |
{ return 1; } |
347 |
bool is_readonly(void) const { return 1; } |
|
1
by brian
clean slate |
348 |
};
|
349 |
||
350 |
||
351 |
class sys_var_enum :public sys_var |
|
352 |
{
|
|
353 |
uint *value; |
|
354 |
TYPELIB *enum_names; |
|
355 |
public: |
|
356 |
sys_var_enum(sys_var_chain *chain, const char *name_arg, uint *value_arg, |
|
357 |
TYPELIB *typelib, sys_after_update_func func) |
|
358 |
:sys_var(name_arg,func), value(value_arg), enum_names(typelib) |
|
359 |
{ chain_sys_var(chain); } |
|
360 |
bool check(THD *thd, set_var *var) |
|
361 |
{
|
|
362 |
return check_enum(thd, var, enum_names); |
|
363 |
}
|
|
364 |
bool update(THD *thd, set_var *var); |
|
365 |
SHOW_TYPE show_type() { return SHOW_CHAR; } |
|
366 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
367 |
bool check_update_type(Item_result type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
368 |
{ return 0; } |
1
by brian
clean slate |
369 |
};
|
370 |
||
371 |
||
372 |
class sys_var_enum_const :public sys_var |
|
373 |
{
|
|
374 |
ulong SV::*offset; |
|
375 |
TYPELIB *enum_names; |
|
376 |
public: |
|
377 |
sys_var_enum_const(sys_var_chain *chain, const char *name_arg, ulong SV::*offset_arg, |
|
378 |
TYPELIB *typelib, sys_after_update_func func) |
|
379 |
:sys_var(name_arg,func), offset(offset_arg), enum_names(typelib) |
|
380 |
{ chain_sys_var(chain); } |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
381 |
bool check(THD *thd __attribute__((unused)), |
382 |
set_var *var __attribute__((unused))) |
|
77.1.7
by Monty Taylor
Heap builds clean. |
383 |
{ return 1; } |
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
384 |
bool update(THD *thd __attribute__((unused)), |
385 |
set_var *var __attribute__((unused))) |
|
77.1.7
by Monty Taylor
Heap builds clean. |
386 |
{ return 1; } |
1
by brian
clean slate |
387 |
SHOW_TYPE show_type() { return SHOW_CHAR; } |
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
388 |
bool check_update_type(Item_result type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
389 |
{ return 1; } |
1
by brian
clean slate |
390 |
bool is_readonly() const { return 1; } |
391 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
392 |
};
|
|
393 |
||
394 |
||
395 |
class sys_var_thd :public sys_var |
|
396 |
{
|
|
397 |
public: |
|
398 |
sys_var_thd(const char *name_arg, |
|
399 |
sys_after_update_func func= NULL, |
|
400 |
Binlog_status_enum binlog_status= NOT_IN_BINLOG) |
|
401 |
:sys_var(name_arg, func, binlog_status) |
|
402 |
{}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
403 |
bool check_type(enum_var_type type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
404 |
{ return 0; } |
1
by brian
clean slate |
405 |
bool check_default(enum_var_type type) |
406 |
{
|
|
407 |
return type == OPT_GLOBAL && !option_limits; |
|
408 |
}
|
|
409 |
};
|
|
410 |
||
411 |
||
412 |
class sys_var_thd_ulong :public sys_var_thd |
|
413 |
{
|
|
414 |
sys_check_func check_func; |
|
415 |
public: |
|
416 |
ulong SV::*offset; |
|
417 |
sys_var_thd_ulong(sys_var_chain *chain, const char *name_arg, |
|
418 |
ulong SV::*offset_arg, |
|
419 |
sys_check_func c_func= NULL, |
|
420 |
sys_after_update_func au_func= NULL, |
|
421 |
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG) |
|
422 |
:sys_var_thd(name_arg, au_func, binlog_status_arg), check_func(c_func), |
|
423 |
offset(offset_arg) |
|
424 |
{ chain_sys_var(chain); } |
|
425 |
bool check(THD *thd, set_var *var); |
|
426 |
bool update(THD *thd, set_var *var); |
|
427 |
void set_default(THD *thd, enum_var_type type); |
|
428 |
SHOW_TYPE show_type() { return SHOW_LONG; } |
|
429 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
430 |
};
|
|
431 |
||
432 |
||
433 |
class sys_var_thd_ha_rows :public sys_var_thd |
|
434 |
{
|
|
435 |
public: |
|
436 |
ha_rows SV::*offset; |
|
437 |
sys_var_thd_ha_rows(sys_var_chain *chain, const char *name_arg, |
|
438 |
ha_rows SV::*offset_arg) |
|
439 |
:sys_var_thd(name_arg), offset(offset_arg) |
|
440 |
{ chain_sys_var(chain); } |
|
441 |
sys_var_thd_ha_rows(sys_var_chain *chain, const char *name_arg, |
|
442 |
ha_rows SV::*offset_arg, |
|
443 |
sys_after_update_func func) |
|
444 |
:sys_var_thd(name_arg,func), offset(offset_arg) |
|
445 |
{ chain_sys_var(chain); } |
|
446 |
bool update(THD *thd, set_var *var); |
|
447 |
void set_default(THD *thd, enum_var_type type); |
|
448 |
SHOW_TYPE show_type() { return SHOW_HA_ROWS; } |
|
449 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
450 |
};
|
|
451 |
||
452 |
||
151
by Brian Aker
Ulonglong to uint64_t |
453 |
class sys_var_thd_uint64_t :public sys_var_thd |
1
by brian
clean slate |
454 |
{
|
455 |
public: |
|
151
by Brian Aker
Ulonglong to uint64_t |
456 |
uint64_t SV::*offset; |
1
by brian
clean slate |
457 |
bool only_global; |
151
by Brian Aker
Ulonglong to uint64_t |
458 |
sys_var_thd_uint64_t(sys_var_chain *chain, const char *name_arg, |
459 |
uint64_t SV::*offset_arg) |
|
1
by brian
clean slate |
460 |
:sys_var_thd(name_arg), offset(offset_arg) |
461 |
{ chain_sys_var(chain); } |
|
151
by Brian Aker
Ulonglong to uint64_t |
462 |
sys_var_thd_uint64_t(sys_var_chain *chain, const char *name_arg, |
463 |
uint64_t SV::*offset_arg, |
|
1
by brian
clean slate |
464 |
sys_after_update_func func, bool only_global_arg) |
465 |
:sys_var_thd(name_arg, func), offset(offset_arg), |
|
466 |
only_global(only_global_arg) |
|
467 |
{ chain_sys_var(chain); } |
|
468 |
bool update(THD *thd, set_var *var); |
|
469 |
void set_default(THD *thd, enum_var_type type); |
|
470 |
SHOW_TYPE show_type() { return SHOW_LONGLONG; } |
|
471 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
472 |
bool check(THD *thd, set_var *var); |
|
473 |
bool check_default(enum_var_type type) |
|
474 |
{
|
|
475 |
return type == OPT_GLOBAL && !option_limits; |
|
476 |
}
|
|
477 |
bool check_type(enum_var_type type) |
|
478 |
{
|
|
479 |
return (only_global && type != OPT_GLOBAL); |
|
480 |
}
|
|
481 |
};
|
|
482 |
||
483 |
||
484 |
class sys_var_thd_bool :public sys_var_thd |
|
485 |
{
|
|
486 |
public: |
|
200
by Brian Aker
my_bool from handler and set_var |
487 |
bool SV::*offset; |
488 |
sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, bool SV::*offset_arg) |
|
1
by brian
clean slate |
489 |
:sys_var_thd(name_arg), offset(offset_arg) |
490 |
{ chain_sys_var(chain); } |
|
200
by Brian Aker
my_bool from handler and set_var |
491 |
sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, bool SV::*offset_arg, |
1
by brian
clean slate |
492 |
sys_after_update_func func) |
493 |
:sys_var_thd(name_arg,func), offset(offset_arg) |
|
494 |
{ chain_sys_var(chain); } |
|
495 |
bool update(THD *thd, set_var *var); |
|
496 |
void set_default(THD *thd, enum_var_type type); |
|
497 |
SHOW_TYPE show_type() { return SHOW_MY_BOOL; } |
|
498 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
499 |
bool check(THD *thd, set_var *var) |
|
500 |
{
|
|
501 |
return check_enum(thd, var, &bool_typelib); |
|
502 |
}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
503 |
bool check_update_type(Item_result type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
504 |
{ return 0; } |
1
by brian
clean slate |
505 |
};
|
506 |
||
507 |
||
508 |
class sys_var_thd_enum :public sys_var_thd |
|
509 |
{
|
|
510 |
protected: |
|
511 |
ulong SV::*offset; |
|
512 |
TYPELIB *enum_names; |
|
513 |
sys_check_func check_func; |
|
514 |
public: |
|
515 |
sys_var_thd_enum(sys_var_chain *chain, const char *name_arg, |
|
516 |
ulong SV::*offset_arg, TYPELIB *typelib, |
|
517 |
sys_after_update_func func= NULL, |
|
518 |
sys_check_func check= NULL) |
|
519 |
:sys_var_thd(name_arg, func), offset(offset_arg), |
|
520 |
enum_names(typelib), check_func(check) |
|
521 |
{ chain_sys_var(chain); } |
|
522 |
bool check(THD *thd, set_var *var) |
|
523 |
{
|
|
524 |
int ret= 0; |
|
525 |
if (check_func) |
|
526 |
ret= (*check_func)(thd, var); |
|
527 |
return ret ? ret : check_enum(thd, var, enum_names); |
|
528 |
}
|
|
529 |
bool update(THD *thd, set_var *var); |
|
530 |
void set_default(THD *thd, enum_var_type type); |
|
531 |
SHOW_TYPE show_type() { return SHOW_CHAR; } |
|
532 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
533 |
bool check_update_type(Item_result type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
534 |
{ return 0; } |
1
by brian
clean slate |
535 |
};
|
536 |
||
537 |
||
538 |
||
539 |
class sys_var_thd_optimizer_switch :public sys_var_thd_enum |
|
540 |
{
|
|
541 |
public: |
|
542 |
sys_var_thd_optimizer_switch(sys_var_chain *chain, const char *name_arg, |
|
543 |
ulong SV::*offset_arg) |
|
544 |
:sys_var_thd_enum(chain, name_arg, offset_arg, &optimizer_switch_typelib) |
|
545 |
{}
|
|
546 |
bool check(THD *thd, set_var *var) |
|
547 |
{
|
|
548 |
return check_set(thd, var, enum_names); |
|
549 |
}
|
|
550 |
void set_default(THD *thd, enum_var_type type); |
|
551 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
151
by Brian Aker
Ulonglong to uint64_t |
552 |
static bool symbolic_mode_representation(THD *thd, uint64_t sql_mode, |
1
by brian
clean slate |
553 |
LEX_STRING *rep); |
554 |
};
|
|
555 |
||
556 |
||
557 |
class sys_var_thd_storage_engine :public sys_var_thd |
|
558 |
{
|
|
559 |
protected: |
|
560 |
plugin_ref SV::*offset; |
|
561 |
public: |
|
562 |
sys_var_thd_storage_engine(sys_var_chain *chain, const char *name_arg, |
|
563 |
plugin_ref SV::*offset_arg) |
|
564 |
:sys_var_thd(name_arg), offset(offset_arg) |
|
565 |
{ chain_sys_var(chain); } |
|
566 |
bool check(THD *thd, set_var *var); |
|
567 |
SHOW_TYPE show_type() { return SHOW_CHAR; } |
|
568 |
bool check_update_type(Item_result type) |
|
569 |
{
|
|
570 |
return type != STRING_RESULT; /* Only accept strings */ |
|
571 |
}
|
|
572 |
void set_default(THD *thd, enum_var_type type); |
|
573 |
bool update(THD *thd, set_var *var); |
|
574 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
575 |
};
|
|
576 |
||
577 |
class sys_var_thd_bit :public sys_var_thd |
|
578 |
{
|
|
579 |
sys_check_func check_func; |
|
580 |
sys_update_func update_func; |
|
581 |
public: |
|
151
by Brian Aker
Ulonglong to uint64_t |
582 |
uint64_t bit_flag; |
1
by brian
clean slate |
583 |
bool reverse; |
584 |
sys_var_thd_bit(sys_var_chain *chain, const char *name_arg, |
|
585 |
sys_check_func c_func, sys_update_func u_func, |
|
151
by Brian Aker
Ulonglong to uint64_t |
586 |
uint64_t bit, bool reverse_arg=0, |
1
by brian
clean slate |
587 |
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG) |
588 |
:sys_var_thd(name_arg, NULL, binlog_status_arg), check_func(c_func), |
|
589 |
update_func(u_func), bit_flag(bit), reverse(reverse_arg) |
|
590 |
{ chain_sys_var(chain); } |
|
591 |
bool check(THD *thd, set_var *var); |
|
592 |
bool update(THD *thd, set_var *var); |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
593 |
bool check_update_type(Item_result type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
594 |
{ return 0; } |
1
by brian
clean slate |
595 |
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; } |
596 |
SHOW_TYPE show_type() { return SHOW_MY_BOOL; } |
|
597 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
598 |
};
|
|
599 |
||
600 |
/* some variables that require special handling */
|
|
601 |
||
602 |
class sys_var_timestamp :public sys_var |
|
603 |
{
|
|
604 |
public: |
|
605 |
sys_var_timestamp(sys_var_chain *chain, const char *name_arg, |
|
606 |
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG) |
|
607 |
:sys_var(name_arg, NULL, binlog_status_arg) |
|
608 |
{ chain_sys_var(chain); } |
|
609 |
bool update(THD *thd, set_var *var); |
|
610 |
void set_default(THD *thd, enum_var_type type); |
|
611 |
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; } |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
612 |
bool check_default(enum_var_type type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
613 |
{ return 0; } |
614 |
SHOW_TYPE show_type(void) { return SHOW_LONG; } |
|
1
by brian
clean slate |
615 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
616 |
};
|
|
617 |
||
618 |
||
619 |
class sys_var_last_insert_id :public sys_var |
|
620 |
{
|
|
621 |
public: |
|
622 |
sys_var_last_insert_id(sys_var_chain *chain, const char *name_arg, |
|
623 |
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG) |
|
624 |
:sys_var(name_arg, NULL, binlog_status_arg) |
|
625 |
{ chain_sys_var(chain); } |
|
626 |
bool update(THD *thd, set_var *var); |
|
627 |
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; } |
|
628 |
SHOW_TYPE show_type() { return SHOW_LONGLONG; } |
|
629 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
630 |
};
|
|
631 |
||
632 |
||
633 |
class sys_var_insert_id :public sys_var |
|
634 |
{
|
|
635 |
public: |
|
636 |
sys_var_insert_id(sys_var_chain *chain, const char *name_arg) |
|
637 |
:sys_var(name_arg) |
|
638 |
{ chain_sys_var(chain); } |
|
639 |
bool update(THD *thd, set_var *var); |
|
640 |
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; } |
|
641 |
SHOW_TYPE show_type() { return SHOW_LONGLONG; } |
|
642 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
643 |
};
|
|
644 |
||
645 |
||
646 |
class sys_var_rand_seed1 :public sys_var |
|
647 |
{
|
|
648 |
public: |
|
649 |
sys_var_rand_seed1(sys_var_chain *chain, const char *name_arg, |
|
650 |
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG) |
|
651 |
:sys_var(name_arg, NULL, binlog_status_arg) |
|
652 |
{ chain_sys_var(chain); } |
|
653 |
bool update(THD *thd, set_var *var); |
|
654 |
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; } |
|
655 |
};
|
|
656 |
||
657 |
class sys_var_rand_seed2 :public sys_var |
|
658 |
{
|
|
659 |
public: |
|
660 |
sys_var_rand_seed2(sys_var_chain *chain, const char *name_arg, |
|
661 |
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG) |
|
662 |
:sys_var(name_arg, NULL, binlog_status_arg) |
|
663 |
{ chain_sys_var(chain); } |
|
664 |
bool update(THD *thd, set_var *var); |
|
665 |
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; } |
|
666 |
};
|
|
667 |
||
668 |
||
669 |
class sys_var_collation :public sys_var_thd |
|
670 |
{
|
|
671 |
public: |
|
672 |
sys_var_collation(const char *name_arg, |
|
673 |
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG) |
|
674 |
:sys_var_thd(name_arg, NULL, binlog_status_arg) |
|
675 |
{
|
|
676 |
no_support_one_shot= 0; |
|
677 |
}
|
|
678 |
bool check(THD *thd, set_var *var); |
|
679 |
SHOW_TYPE show_type() { return SHOW_CHAR; } |
|
680 |
bool check_update_type(Item_result type) |
|
681 |
{
|
|
682 |
return ((type != STRING_RESULT) && (type != INT_RESULT)); |
|
683 |
}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
684 |
bool check_default(enum_var_type type __attribute__((unused))) { return 0; } |
1
by brian
clean slate |
685 |
virtual void set_default(THD *thd, enum_var_type type)= 0; |
686 |
};
|
|
687 |
||
688 |
class sys_var_character_set :public sys_var_thd |
|
689 |
{
|
|
690 |
public: |
|
691 |
bool nullable; |
|
692 |
sys_var_character_set(const char *name_arg, bool is_nullable= 0, |
|
693 |
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG) |
|
694 |
:sys_var_thd(name_arg, NULL, binlog_status_arg), nullable(is_nullable) |
|
695 |
{
|
|
696 |
/*
|
|
697 |
In fact only almost all variables derived from sys_var_character_set
|
|
698 |
support ONE_SHOT; character_set_results doesn't. But that's good enough.
|
|
699 |
*/
|
|
700 |
no_support_one_shot= 0; |
|
701 |
}
|
|
702 |
bool check(THD *thd, set_var *var); |
|
703 |
SHOW_TYPE show_type() { return SHOW_CHAR; } |
|
704 |
bool check_update_type(Item_result type) |
|
705 |
{
|
|
706 |
return ((type != STRING_RESULT) && (type != INT_RESULT)); |
|
707 |
}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
708 |
bool check_default(enum_var_type type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
709 |
{ return 0; } |
1
by brian
clean slate |
710 |
bool update(THD *thd, set_var *var); |
711 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
712 |
virtual void set_default(THD *thd, enum_var_type type)= 0; |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
713 |
virtual const CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0; |
1
by brian
clean slate |
714 |
};
|
715 |
||
716 |
class sys_var_character_set_sv :public sys_var_character_set |
|
717 |
{
|
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
718 |
const CHARSET_INFO *SV::*offset; |
719 |
const CHARSET_INFO **global_default; |
|
1
by brian
clean slate |
720 |
public: |
721 |
sys_var_character_set_sv(sys_var_chain *chain, const char *name_arg, |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
722 |
const CHARSET_INFO *SV::*offset_arg, |
723 |
const CHARSET_INFO **global_default_arg, |
|
1
by brian
clean slate |
724 |
bool is_nullable= 0, |
725 |
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG) |
|
726 |
: sys_var_character_set(name_arg, is_nullable, binlog_status_arg), |
|
727 |
offset(offset_arg), global_default(global_default_arg) |
|
728 |
{ chain_sys_var(chain); } |
|
729 |
void set_default(THD *thd, enum_var_type type); |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
730 |
const CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type); |
1
by brian
clean slate |
731 |
};
|
732 |
||
733 |
||
734 |
class sys_var_character_set_client: public sys_var_character_set_sv |
|
735 |
{
|
|
736 |
public: |
|
737 |
sys_var_character_set_client(sys_var_chain *chain, const char *name_arg, |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
738 |
const CHARSET_INFO *SV::*offset_arg, |
739 |
const CHARSET_INFO **global_default_arg, |
|
1
by brian
clean slate |
740 |
Binlog_status_enum binlog_status_arg) |
741 |
: sys_var_character_set_sv(chain, name_arg, offset_arg, global_default_arg, |
|
742 |
0, binlog_status_arg) |
|
743 |
{ } |
|
744 |
bool check(THD *thd, set_var *var); |
|
745 |
};
|
|
746 |
||
747 |
||
748 |
class sys_var_character_set_database :public sys_var_character_set |
|
749 |
{
|
|
750 |
public: |
|
751 |
sys_var_character_set_database(sys_var_chain *chain, const char *name_arg, |
|
752 |
Binlog_status_enum binlog_status_arg= |
|
753 |
NOT_IN_BINLOG) |
|
754 |
: sys_var_character_set(name_arg, 0, binlog_status_arg) |
|
755 |
{ chain_sys_var(chain); } |
|
756 |
void set_default(THD *thd, enum_var_type type); |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
757 |
const CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type); |
1
by brian
clean slate |
758 |
};
|
759 |
||
760 |
class sys_var_collation_sv :public sys_var_collation |
|
761 |
{
|
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
762 |
const CHARSET_INFO *SV::*offset; |
763 |
const CHARSET_INFO **global_default; |
|
1
by brian
clean slate |
764 |
public: |
765 |
sys_var_collation_sv(sys_var_chain *chain, const char *name_arg, |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
766 |
const CHARSET_INFO *SV::*offset_arg, |
767 |
const CHARSET_INFO **global_default_arg, |
|
1
by brian
clean slate |
768 |
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG) |
769 |
:sys_var_collation(name_arg, binlog_status_arg), |
|
770 |
offset(offset_arg), global_default(global_default_arg) |
|
771 |
{
|
|
772 |
chain_sys_var(chain); |
|
773 |
}
|
|
774 |
bool update(THD *thd, set_var *var); |
|
775 |
void set_default(THD *thd, enum_var_type type); |
|
776 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
777 |
};
|
|
778 |
||
779 |
||
780 |
class sys_var_key_cache_param :public sys_var |
|
781 |
{
|
|
782 |
protected: |
|
783 |
size_t offset; |
|
784 |
public: |
|
785 |
sys_var_key_cache_param(sys_var_chain *chain, const char *name_arg, |
|
786 |
size_t offset_arg) |
|
787 |
:sys_var(name_arg), offset(offset_arg) |
|
788 |
{ chain_sys_var(chain); } |
|
789 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
790 |
bool check_default(enum_var_type type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
791 |
{ return 1; } |
1
by brian
clean slate |
792 |
bool is_struct() { return 1; } |
793 |
};
|
|
794 |
||
795 |
||
796 |
class sys_var_key_buffer_size :public sys_var_key_cache_param |
|
797 |
{
|
|
798 |
public: |
|
799 |
sys_var_key_buffer_size(sys_var_chain *chain, const char *name_arg) |
|
800 |
:sys_var_key_cache_param(chain, name_arg, |
|
801 |
offsetof(KEY_CACHE, param_buff_size)) |
|
802 |
{}
|
|
803 |
bool update(THD *thd, set_var *var); |
|
804 |
SHOW_TYPE show_type() { return SHOW_LONGLONG; } |
|
805 |
};
|
|
806 |
||
807 |
||
808 |
class sys_var_key_cache_long :public sys_var_key_cache_param |
|
809 |
{
|
|
810 |
public: |
|
811 |
sys_var_key_cache_long(sys_var_chain *chain, const char *name_arg, size_t offset_arg) |
|
812 |
:sys_var_key_cache_param(chain, name_arg, offset_arg) |
|
813 |
{}
|
|
814 |
bool update(THD *thd, set_var *var); |
|
815 |
SHOW_TYPE show_type() { return SHOW_LONG; } |
|
816 |
};
|
|
817 |
||
818 |
||
819 |
class sys_var_thd_date_time_format :public sys_var_thd |
|
820 |
{
|
|
821 |
DATE_TIME_FORMAT *SV::*offset; |
|
822 |
timestamp_type date_time_type; |
|
823 |
public: |
|
824 |
sys_var_thd_date_time_format(sys_var_chain *chain, const char *name_arg, |
|
825 |
DATE_TIME_FORMAT *SV::*offset_arg, |
|
826 |
timestamp_type date_time_type_arg) |
|
827 |
:sys_var_thd(name_arg), offset(offset_arg), |
|
828 |
date_time_type(date_time_type_arg) |
|
829 |
{ chain_sys_var(chain); } |
|
830 |
SHOW_TYPE show_type() { return SHOW_CHAR; } |
|
831 |
bool check_update_type(Item_result type) |
|
832 |
{
|
|
833 |
return type != STRING_RESULT; /* Only accept strings */ |
|
834 |
}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
835 |
bool check_default(enum_var_type type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
836 |
{ return 0; } |
1
by brian
clean slate |
837 |
bool check(THD *thd, set_var *var); |
838 |
bool update(THD *thd, set_var *var); |
|
839 |
void update2(THD *thd, enum_var_type type, DATE_TIME_FORMAT *new_value); |
|
840 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
841 |
void set_default(THD *thd, enum_var_type type); |
|
842 |
};
|
|
843 |
||
844 |
||
845 |
class sys_var_log_state :public sys_var_bool_ptr |
|
846 |
{
|
|
847 |
uint log_type; |
|
848 |
public: |
|
147
by Brian Aker
More my_bool conversion. This time the set_var class. |
849 |
sys_var_log_state(sys_var_chain *chain, const char *name_arg, bool *value_arg, |
1
by brian
clean slate |
850 |
uint log_type_arg) |
851 |
:sys_var_bool_ptr(chain, name_arg, value_arg), log_type(log_type_arg) {} |
|
852 |
bool update(THD *thd, set_var *var); |
|
853 |
void set_default(THD *thd, enum_var_type type); |
|
854 |
};
|
|
855 |
||
856 |
||
857 |
class sys_var_set :public sys_var |
|
858 |
{
|
|
859 |
protected: |
|
860 |
ulong *value; |
|
861 |
TYPELIB *enum_names; |
|
862 |
public: |
|
863 |
sys_var_set(sys_var_chain *chain, const char *name_arg, ulong *value_arg, |
|
864 |
TYPELIB *typelib, sys_after_update_func func) |
|
865 |
:sys_var(name_arg, func), value(value_arg), enum_names(typelib) |
|
866 |
{ chain_sys_var(chain); } |
|
867 |
virtual bool check(THD *thd, set_var *var) |
|
868 |
{
|
|
869 |
return check_set(thd, var, enum_names); |
|
870 |
}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
871 |
virtual void set_default(THD *thd __attribute__((unused)), |
872 |
enum_var_type type __attribute__((unused))) |
|
77.1.7
by Monty Taylor
Heap builds clean. |
873 |
{
|
1
by brian
clean slate |
874 |
*value= 0; |
875 |
}
|
|
876 |
bool update(THD *thd, set_var *var); |
|
877 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
878 |
bool check_update_type(Item_result type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
879 |
{ return 0; } |
1
by brian
clean slate |
880 |
SHOW_TYPE show_type() { return SHOW_CHAR; } |
881 |
};
|
|
882 |
||
883 |
class sys_var_set_slave_mode :public sys_var_set |
|
884 |
{
|
|
885 |
public: |
|
886 |
sys_var_set_slave_mode(sys_var_chain *chain, const char *name_arg, |
|
887 |
ulong *value_arg, |
|
888 |
TYPELIB *typelib, sys_after_update_func func) : |
|
889 |
sys_var_set(chain, name_arg, value_arg, typelib, func) {} |
|
890 |
void set_default(THD *thd, enum_var_type type); |
|
891 |
bool check(THD *thd, set_var *var); |
|
892 |
bool update(THD *thd, set_var *var); |
|
893 |
};
|
|
894 |
||
895 |
class sys_var_log_output :public sys_var |
|
896 |
{
|
|
897 |
ulong *value; |
|
898 |
TYPELIB *enum_names; |
|
899 |
public: |
|
900 |
sys_var_log_output(sys_var_chain *chain, const char *name_arg, ulong *value_arg, |
|
901 |
TYPELIB *typelib, sys_after_update_func func) |
|
902 |
:sys_var(name_arg,func), value(value_arg), enum_names(typelib) |
|
903 |
{
|
|
904 |
chain_sys_var(chain); |
|
51.1.46
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
905 |
set_allow_empty_value(false); |
1
by brian
clean slate |
906 |
}
|
907 |
virtual bool check(THD *thd, set_var *var) |
|
908 |
{
|
|
909 |
return check_set(thd, var, enum_names); |
|
910 |
}
|
|
911 |
bool update(THD *thd, set_var *var); |
|
912 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
913 |
bool check_update_type(Item_result type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
914 |
{ return 0; } |
1
by brian
clean slate |
915 |
void set_default(THD *thd, enum_var_type type); |
916 |
SHOW_TYPE show_type() { return SHOW_CHAR; } |
|
917 |
};
|
|
918 |
||
919 |
||
920 |
/* Variable that you can only read from */
|
|
921 |
||
922 |
class sys_var_readonly: public sys_var |
|
923 |
{
|
|
924 |
public: |
|
925 |
enum_var_type var_type; |
|
926 |
SHOW_TYPE show_type_value; |
|
927 |
sys_value_ptr_func value_ptr_func; |
|
928 |
sys_var_readonly(sys_var_chain *chain, const char *name_arg, enum_var_type type, |
|
929 |
SHOW_TYPE show_type_arg, |
|
930 |
sys_value_ptr_func value_ptr_func_arg) |
|
931 |
:sys_var(name_arg), var_type(type), |
|
932 |
show_type_value(show_type_arg), value_ptr_func(value_ptr_func_arg) |
|
933 |
{ chain_sys_var(chain); } |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
934 |
bool update(THD *thd __attribute__((unused)), |
935 |
set_var *var __attribute__((unused))) |
|
77.1.7
by Monty Taylor
Heap builds clean. |
936 |
{ return 1; } |
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
937 |
bool check_default(enum_var_type type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
938 |
{ return 1; } |
1
by brian
clean slate |
939 |
bool check_type(enum_var_type type) { return type != var_type; } |
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
940 |
bool check_update_type(Item_result type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
941 |
{ return 1; } |
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
942 |
uchar *value_ptr(THD *thd, enum_var_type type __attribute__((unused)), |
943 |
LEX_STRING *base __attribute__((unused))) |
|
1
by brian
clean slate |
944 |
{
|
945 |
return (*value_ptr_func)(thd); |
|
946 |
}
|
|
77.1.7
by Monty Taylor
Heap builds clean. |
947 |
SHOW_TYPE show_type(void) { return show_type_value; } |
948 |
bool is_readonly(void) const { return 1; } |
|
1
by brian
clean slate |
949 |
};
|
950 |
||
951 |
||
952 |
class sys_var_have_option: public sys_var |
|
953 |
{
|
|
954 |
protected: |
|
955 |
virtual SHOW_COMP_OPTION get_option() = 0; |
|
956 |
public: |
|
957 |
sys_var_have_option(sys_var_chain *chain, const char *variable_name): |
|
958 |
sys_var(variable_name) |
|
959 |
{ chain_sys_var(chain); } |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
960 |
uchar *value_ptr(THD *thd __attribute__((unused)), |
961 |
enum_var_type type __attribute__((unused)), |
|
962 |
LEX_STRING *base __attribute__((unused))) |
|
1
by brian
clean slate |
963 |
{
|
964 |
return (uchar*) show_comp_option_name[get_option()]; |
|
965 |
}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
966 |
bool update(THD *thd __attribute__((unused)), |
967 |
set_var *var __attribute__((unused))) { return 1; } |
|
968 |
bool check_default(enum_var_type type __attribute__((unused))) |
|
77.1.7
by Monty Taylor
Heap builds clean. |
969 |
{ return 1; } |
1
by brian
clean slate |
970 |
bool check_type(enum_var_type type) { return type != OPT_GLOBAL; } |
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
971 |
bool check_update_type(Item_result type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
972 |
{ return 1; } |
1
by brian
clean slate |
973 |
SHOW_TYPE show_type() { return SHOW_CHAR; } |
974 |
bool is_readonly() const { return 1; } |
|
975 |
};
|
|
976 |
||
977 |
||
978 |
class sys_var_have_variable: public sys_var_have_option |
|
979 |
{
|
|
980 |
SHOW_COMP_OPTION *have_variable; |
|
981 |
||
982 |
public: |
|
983 |
sys_var_have_variable(sys_var_chain *chain, const char *variable_name, |
|
984 |
SHOW_COMP_OPTION *have_variable_arg): |
|
985 |
sys_var_have_option(chain, variable_name), |
|
986 |
have_variable(have_variable_arg) |
|
987 |
{ } |
|
988 |
SHOW_COMP_OPTION get_option() { return *have_variable; } |
|
989 |
};
|
|
990 |
||
991 |
||
992 |
class sys_var_have_plugin: public sys_var_have_option |
|
993 |
{
|
|
994 |
const char *plugin_name_str; |
|
995 |
const uint plugin_name_len; |
|
996 |
const int plugin_type; |
|
997 |
||
998 |
public: |
|
999 |
sys_var_have_plugin(sys_var_chain *chain, const char *variable_name, |
|
1000 |
const char *plugin_name_str_arg, uint plugin_name_len_arg, |
|
1001 |
int plugin_type_arg): |
|
1002 |
sys_var_have_option(chain, variable_name), |
|
1003 |
plugin_name_str(plugin_name_str_arg), plugin_name_len(plugin_name_len_arg), |
|
1004 |
plugin_type(plugin_type_arg) |
|
1005 |
{ } |
|
1006 |
/* the following method is declared in sql_plugin.cc */
|
|
1007 |
SHOW_COMP_OPTION get_option(); |
|
1008 |
};
|
|
1009 |
||
1010 |
||
1011 |
class sys_var_thd_time_zone :public sys_var_thd |
|
1012 |
{
|
|
1013 |
public: |
|
1014 |
sys_var_thd_time_zone(sys_var_chain *chain, const char *name_arg, |
|
1015 |
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG) |
|
1016 |
:sys_var_thd(name_arg, NULL, binlog_status_arg) |
|
1017 |
{
|
|
1018 |
no_support_one_shot= 0; |
|
1019 |
chain_sys_var(chain); |
|
1020 |
}
|
|
1021 |
bool check(THD *thd, set_var *var); |
|
1022 |
SHOW_TYPE show_type() { return SHOW_CHAR; } |
|
1023 |
bool check_update_type(Item_result type) |
|
1024 |
{
|
|
1025 |
return type != STRING_RESULT; /* Only accept strings */ |
|
1026 |
}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
1027 |
bool check_default(enum_var_type type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
1028 |
{ return 0; } |
1
by brian
clean slate |
1029 |
bool update(THD *thd, set_var *var); |
1030 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
1031 |
virtual void set_default(THD *thd, enum_var_type type); |
|
1032 |
};
|
|
1033 |
||
1034 |
||
1035 |
class sys_var_max_user_conn : public sys_var_thd |
|
1036 |
{
|
|
1037 |
public: |
|
1038 |
sys_var_max_user_conn(sys_var_chain *chain, const char *name_arg): |
|
1039 |
sys_var_thd(name_arg) |
|
1040 |
{ chain_sys_var(chain); } |
|
1041 |
bool check(THD *thd, set_var *var); |
|
1042 |
bool update(THD *thd, set_var *var); |
|
1043 |
bool check_default(enum_var_type type) |
|
1044 |
{
|
|
1045 |
return type != OPT_GLOBAL || !option_limits; |
|
1046 |
}
|
|
1047 |
void set_default(THD *thd, enum_var_type type); |
|
1048 |
SHOW_TYPE show_type() { return SHOW_INT; } |
|
1049 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
1050 |
};
|
|
1051 |
||
1052 |
||
1053 |
class sys_var_microseconds :public sys_var_thd |
|
1054 |
{
|
|
151
by Brian Aker
Ulonglong to uint64_t |
1055 |
uint64_t SV::*offset; |
1
by brian
clean slate |
1056 |
public: |
1057 |
sys_var_microseconds(sys_var_chain *chain, const char *name_arg, |
|
151
by Brian Aker
Ulonglong to uint64_t |
1058 |
uint64_t SV::*offset_arg): |
1
by brian
clean slate |
1059 |
sys_var_thd(name_arg), offset(offset_arg) |
1060 |
{ chain_sys_var(chain); } |
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
1061 |
bool check(THD *thd __attribute__((unused)), |
1062 |
set_var *var __attribute__((unused))) {return 0;} |
|
1
by brian
clean slate |
1063 |
bool update(THD *thd, set_var *var); |
1064 |
void set_default(THD *thd, enum_var_type type); |
|
1065 |
SHOW_TYPE show_type() { return SHOW_DOUBLE; } |
|
1066 |
bool check_update_type(Item_result type) |
|
1067 |
{
|
|
1068 |
return (type != INT_RESULT && type != REAL_RESULT && type != DECIMAL_RESULT); |
|
1069 |
}
|
|
1070 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
1071 |
};
|
|
1072 |
||
1073 |
/**
|
|
1074 |
Handler for setting the system variable --read-only.
|
|
1075 |
*/
|
|
1076 |
||
1077 |
class sys_var_opt_readonly :public sys_var_bool_ptr |
|
1078 |
{
|
|
1079 |
public: |
|
1080 |
sys_var_opt_readonly(sys_var_chain *chain, const char *name_arg, |
|
147
by Brian Aker
More my_bool conversion. This time the set_var class. |
1081 |
bool *value_arg) : |
1
by brian
clean slate |
1082 |
sys_var_bool_ptr(chain, name_arg, value_arg) {}; |
1083 |
~sys_var_opt_readonly() {}; |
|
1084 |
bool update(THD *thd, set_var *var); |
|
1085 |
};
|
|
1086 |
||
1087 |
||
1088 |
class sys_var_thd_lc_time_names :public sys_var_thd |
|
1089 |
{
|
|
1090 |
public: |
|
1091 |
sys_var_thd_lc_time_names(sys_var_chain *chain, const char *name_arg, |
|
1092 |
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG) |
|
1093 |
: sys_var_thd(name_arg, NULL, binlog_status_arg) |
|
1094 |
{
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
1095 |
#if DRIZZLE_VERSION_ID < 50000
|
1
by brian
clean slate |
1096 |
no_support_one_shot= 0; |
1097 |
#endif
|
|
1098 |
chain_sys_var(chain); |
|
1099 |
}
|
|
1100 |
bool check(THD *thd, set_var *var); |
|
1101 |
SHOW_TYPE show_type() { return SHOW_CHAR; } |
|
1102 |
bool check_update_type(Item_result type) |
|
1103 |
{
|
|
1104 |
return ((type != STRING_RESULT) && (type != INT_RESULT)); |
|
1105 |
}
|
|
212.1.3
by Monty Taylor
Renamed __attribute__((__unused__)) to __attribute__((unused)). |
1106 |
bool check_default(enum_var_type type __attribute__((unused))) |
77.1.7
by Monty Taylor
Heap builds clean. |
1107 |
{ return 0; } |
1
by brian
clean slate |
1108 |
bool update(THD *thd, set_var *var); |
1109 |
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); |
|
1110 |
virtual void set_default(THD *thd, enum_var_type type); |
|
1111 |
};
|
|
1112 |
||
1113 |
||
1114 |
extern void fix_binlog_format_after_update(THD *thd, enum_var_type type); |
|
1115 |
||
1116 |
class sys_var_thd_binlog_format :public sys_var_thd_enum |
|
1117 |
{
|
|
1118 |
public: |
|
1119 |
sys_var_thd_binlog_format(sys_var_chain *chain, const char *name_arg, |
|
1120 |
ulong SV::*offset_arg) |
|
1121 |
:sys_var_thd_enum(chain, name_arg, offset_arg, |
|
1122 |
&binlog_format_typelib, |
|
1123 |
fix_binlog_format_after_update) |
|
1124 |
{};
|
|
1125 |
bool is_readonly() const; |
|
1126 |
};
|
|
1127 |
||
1128 |
/****************************************************************************
|
|
1129 |
Classes for parsing of the SET command
|
|
1130 |
****************************************************************************/
|
|
1131 |
||
1132 |
class set_var_base :public Sql_alloc |
|
1133 |
{
|
|
1134 |
public: |
|
1135 |
set_var_base() {} |
|
1136 |
virtual ~set_var_base() {} |
|
1137 |
virtual int check(THD *thd)=0; /* To check privileges etc. */ |
|
1138 |
virtual int update(THD *thd)=0; /* To set the value */ |
|
1139 |
/* light check for PS */
|
|
1140 |
virtual bool no_support_one_shot() { return 1; } |
|
1141 |
};
|
|
1142 |
||
1143 |
||
141
by Brian Aker
Code cleanup. Mainly dead stuff :) |
1144 |
/* MySQL internal variables */
|
1
by brian
clean slate |
1145 |
|
1146 |
class set_var :public set_var_base |
|
1147 |
{
|
|
1148 |
public: |
|
1149 |
sys_var *var; |
|
1150 |
Item *value; |
|
1151 |
enum_var_type type; |
|
1152 |
union
|
|
1153 |
{
|
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1154 |
const CHARSET_INFO *charset; |
1
by brian
clean slate |
1155 |
ulong ulong_value; |
151
by Brian Aker
Ulonglong to uint64_t |
1156 |
uint64_t uint64_t_value; |
1
by brian
clean slate |
1157 |
plugin_ref plugin; |
1158 |
DATE_TIME_FORMAT *date_time_format; |
|
1159 |
Time_zone *time_zone; |
|
1160 |
MY_LOCALE *locale_value; |
|
1161 |
} save_result; |
|
1162 |
LEX_STRING base; /* for structs */ |
|
1163 |
||
1164 |
set_var(enum_var_type type_arg, sys_var *var_arg, |
|
1165 |
const LEX_STRING *base_name_arg, Item *value_arg) |
|
1166 |
:var(var_arg), type(type_arg), base(*base_name_arg) |
|
1167 |
{
|
|
1168 |
/*
|
|
1169 |
If the set value is a field, change it to a string to allow things like
|
|
1170 |
SET table_type=MYISAM;
|
|
1171 |
*/
|
|
1172 |
if (value_arg && value_arg->type() == Item::FIELD_ITEM) |
|
1173 |
{
|
|
1174 |
Item_field *item= (Item_field*) value_arg; |
|
1175 |
if (!(value=new Item_string(item->field_name, |
|
1176 |
(uint) strlen(item->field_name), |
|
1177 |
item->collation.collation))) |
|
1178 |
value=value_arg; /* Give error message later */ |
|
1179 |
}
|
|
1180 |
else
|
|
1181 |
value=value_arg; |
|
1182 |
}
|
|
1183 |
int check(THD *thd); |
|
1184 |
int update(THD *thd); |
|
1185 |
bool no_support_one_shot() { return var->no_support_one_shot; } |
|
1186 |
};
|
|
1187 |
||
1188 |
||
1189 |
/* User variables like @my_own_variable */
|
|
1190 |
||
1191 |
class set_var_user: public set_var_base |
|
1192 |
{
|
|
1193 |
Item_func_set_user_var *user_var_item; |
|
1194 |
public: |
|
1195 |
set_var_user(Item_func_set_user_var *item) |
|
1196 |
:user_var_item(item) |
|
1197 |
{}
|
|
1198 |
int check(THD *thd); |
|
1199 |
int update(THD *thd); |
|
1200 |
};
|
|
1201 |
||
1202 |
/* For SET NAMES and SET CHARACTER SET */
|
|
1203 |
||
1204 |
class set_var_collation_client: public set_var_base |
|
1205 |
{
|
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1206 |
const CHARSET_INFO *character_set_client; |
1207 |
const CHARSET_INFO *character_set_results; |
|
1208 |
const CHARSET_INFO *collation_connection; |
|
1
by brian
clean slate |
1209 |
public: |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1210 |
set_var_collation_client(const CHARSET_INFO * const client_coll_arg, |
1211 |
const CHARSET_INFO * const connection_coll_arg, |
|
1212 |
const CHARSET_INFO * const result_coll_arg) |
|
1
by brian
clean slate |
1213 |
:character_set_client(client_coll_arg), |
1214 |
character_set_results(result_coll_arg), |
|
1215 |
collation_connection(connection_coll_arg) |
|
1216 |
{}
|
|
1217 |
int check(THD *thd); |
|
1218 |
int update(THD *thd); |
|
1219 |
};
|
|
1220 |
||
1221 |
||
1222 |
extern "C" |
|
1223 |
{
|
|
1224 |
typedef int (*process_key_cache_t) (const char *, KEY_CACHE *); |
|
1225 |
}
|
|
1226 |
||
1227 |
/* Named lists (used for keycaches) */
|
|
1228 |
||
1229 |
class NAMED_LIST :public ilink |
|
1230 |
{
|
|
1231 |
const char *name; |
|
1232 |
uint name_length; |
|
1233 |
public: |
|
1234 |
uchar* data; |
|
1235 |
||
1236 |
NAMED_LIST(I_List<NAMED_LIST> *links, const char *name_arg, |
|
1237 |
uint name_length_arg, uchar* data_arg) |
|
1238 |
:name_length(name_length_arg), data(data_arg) |
|
1239 |
{
|
|
1240 |
name= my_strndup(name_arg, name_length, MYF(MY_WME)); |
|
1241 |
links->push_back(this); |
|
1242 |
}
|
|
1243 |
inline bool cmp(const char *name_cmp, uint length) |
|
1244 |
{
|
|
1245 |
return length == name_length && !memcmp(name, name_cmp, length); |
|
1246 |
}
|
|
1247 |
~NAMED_LIST() |
|
1248 |
{
|
|
1249 |
my_free((uchar*) name, MYF(0)); |
|
1250 |
}
|
|
1251 |
friend bool process_key_caches(process_key_cache_t func); |
|
1252 |
friend void delete_elements(I_List<NAMED_LIST> *list, |
|
1253 |
void (*free_element)(const char*, uchar*)); |
|
1254 |
};
|
|
1255 |
||
1256 |
/* updated in sql_acl.cc */
|
|
1257 |
||
1258 |
extern sys_var_thd_bool sys_old_alter_table; |
|
1259 |
extern LEX_STRING default_key_cache_base; |
|
1260 |
||
1261 |
/* For sql_yacc */
|
|
1262 |
struct sys_var_with_base |
|
1263 |
{
|
|
1264 |
sys_var *var; |
|
1265 |
LEX_STRING base_name; |
|
1266 |
};
|
|
1267 |
||
1268 |
/*
|
|
1269 |
Prototypes for helper functions
|
|
1270 |
*/
|
|
1271 |
||
1272 |
int set_var_init(); |
|
1273 |
void set_var_free(); |
|
1274 |
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint count); |
|
1275 |
SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted); |
|
1276 |
int mysql_add_sys_var_chain(sys_var *chain, struct my_option *long_options); |
|
1277 |
int mysql_del_sys_var_chain(sys_var *chain); |
|
1278 |
sys_var *find_sys_var(THD *thd, const char *str, uint length=0); |
|
1279 |
int sql_set_variables(THD *thd, List<set_var_base> *var_list); |
|
1280 |
bool not_all_support_one_shot(List<set_var_base> *var_list); |
|
1281 |
void fix_delay_key_write(THD *thd, enum_var_type type); |
|
1282 |
void fix_slave_exec_mode(enum_var_type type); |
|
1283 |
extern sys_var_const_str sys_charset_system; |
|
1284 |
extern sys_var_str sys_init_connect; |
|
1285 |
extern sys_var_str sys_init_slave; |
|
1286 |
extern sys_var_thd_time_zone sys_time_zone; |
|
1287 |
extern sys_var_thd_bit sys_autocommit; |
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
1288 |
const CHARSET_INFO *get_old_charset_by_name(const char *old_name); |
1
by brian
clean slate |
1289 |
uchar* find_named(I_List<NAMED_LIST> *list, const char *name, uint length, |
1290 |
NAMED_LIST **found); |
|
1291 |
||
1292 |
extern sys_var_str sys_var_general_log_path, sys_var_slow_log_path; |
|
1293 |
||
1294 |
/* key_cache functions */
|
|
1295 |
KEY_CACHE *get_key_cache(LEX_STRING *cache_name); |
|
1296 |
KEY_CACHE *get_or_create_key_cache(const char *name, uint length); |
|
1297 |
void free_key_cache(const char *name, KEY_CACHE *key_cache); |
|
1298 |
bool process_key_caches(process_key_cache_t func); |
|
1299 |
void delete_elements(I_List<NAMED_LIST> *list, |
|
1300 |
void (*free_element)(const char*, uchar*)); |