1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
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.
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.
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
1
/* Copyright (C) 2002-2006 MySQL AB
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.
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.
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 */
20
16
/* Classes to support the SET command */
18
#ifdef USE_PRAGMA_INTERFACE
19
#pragma interface /* gcc class implementation */
23
22
/****************************************************************************
24
23
Variables that are changable runtime are declared using the
96
95
(binlog_status == SESSION_VARIABLE_IN_BINLOG);
98
97
virtual bool update(THD *thd, set_var *var)=0;
99
virtual void set_default(THD *thd_arg __attribute__((unused)),
100
enum_var_type type __attribute__((unused)))
98
virtual void set_default(THD *thd_arg, enum_var_type type) {}
102
99
virtual SHOW_TYPE show_type() { return SHOW_UNDEF; }
103
virtual unsigned char *value_ptr(THD *thd __attribute__((unused)),
104
enum_var_type type __attribute__((unused)),
105
LEX_STRING *base __attribute__((unused)))
100
virtual uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
107
102
virtual bool check_type(enum_var_type type)
108
103
{ return type != OPT_GLOBAL; } /* Error if not GLOBAL */
109
104
virtual bool check_update_type(Item_result type)
110
105
{ return type != INT_RESULT; } /* Assume INT */
111
virtual bool check_default(enum_var_type type __attribute__((unused)))
106
virtual bool check_default(enum_var_type type)
112
107
{ return option_limits == 0; }
113
108
Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
114
109
virtual bool is_struct() { return 0; }
164
159
bool update(THD *thd, set_var *var);
165
160
void set_default(THD *thd, enum_var_type type);
166
161
SHOW_TYPE show_type() { return SHOW_LONG; }
167
unsigned char *value_ptr(THD *thd __attribute__((unused)),
168
enum_var_type type __attribute__((unused)),
169
LEX_STRING *base __attribute__((unused)))
170
{ return (unsigned char*) value; }
162
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
163
{ return (uchar*) value; }
186
class sys_var_uint64_t_ptr :public sys_var
179
class sys_var_ulonglong_ptr :public sys_var
190
sys_var_uint64_t_ptr(sys_var_chain *chain, const char *name_arg, uint64_t *value_ptr_arg)
183
sys_var_ulonglong_ptr(sys_var_chain *chain, const char *name_arg, ulonglong *value_ptr_arg)
191
184
:sys_var(name_arg),value(value_ptr_arg)
192
185
{ chain_sys_var(chain); }
193
sys_var_uint64_t_ptr(sys_var_chain *chain, const char *name_arg, uint64_t *value_ptr_arg,
186
sys_var_ulonglong_ptr(sys_var_chain *chain, const char *name_arg, ulonglong *value_ptr_arg,
194
187
sys_after_update_func func)
195
188
:sys_var(name_arg,func), value(value_ptr_arg)
196
189
{ chain_sys_var(chain); }
197
190
bool update(THD *thd, set_var *var);
198
191
void set_default(THD *thd, enum_var_type type);
199
192
SHOW_TYPE show_type() { return SHOW_LONGLONG; }
200
unsigned char *value_ptr(THD *thd __attribute__((unused)),
201
enum_var_type type __attribute__((unused)),
202
LEX_STRING *base __attribute__((unused)))
203
{ return (unsigned char*) value; }
193
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
194
{ return (uchar*) value; }
207
198
class sys_var_bool_ptr :public sys_var
211
sys_var_bool_ptr(sys_var_chain *chain, const char *name_arg, bool *value_arg)
202
sys_var_bool_ptr(sys_var_chain *chain, const char *name_arg, my_bool *value_arg)
212
203
:sys_var(name_arg),value(value_arg)
213
204
{ chain_sys_var(chain); }
214
205
bool check(THD *thd, set_var *var)
218
209
bool update(THD *thd, set_var *var);
219
210
void set_default(THD *thd, enum_var_type type);
220
211
SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
221
unsigned char *value_ptr(THD *thd __attribute__((unused)),
222
enum_var_type type __attribute__((unused)),
223
LEX_STRING *base __attribute__((unused)))
224
{ return (unsigned char*) value; }
225
bool check_update_type(Item_result type __attribute__((unused)))
212
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
213
{ return (uchar*) value; }
214
bool check_update_type(Item_result type) { return 0; }
229
218
class sys_var_bool_ptr_readonly :public sys_var_bool_ptr
232
221
sys_var_bool_ptr_readonly(sys_var_chain *chain, const char *name_arg,
234
223
:sys_var_bool_ptr(chain, name_arg, value_arg)
236
225
bool is_readonly() const { return 1; }
263
252
(*set_default_func)(thd, type);
265
254
SHOW_TYPE show_type() { return SHOW_CHAR; }
266
unsigned char *value_ptr(THD *thd __attribute__((unused)),
267
enum_var_type type __attribute__((unused)),
268
LEX_STRING *base __attribute__((unused)))
269
{ return (unsigned char*) value; }
255
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
256
{ return (uchar*) value; }
270
257
bool check_update_type(Item_result type)
272
259
return type != STRING_RESULT; /* Only accept strings */
274
bool check_default(enum_var_type type __attribute__((unused)))
261
bool check_default(enum_var_type type) { return 0; }
289
275
value= new_value;
291
bool check(THD *thd __attribute__((unused)),
292
set_var *var __attribute__((unused)))
277
bool check(THD *thd, set_var *var)
296
bool update(THD *thd __attribute__((unused)),
297
set_var *var __attribute__((unused)))
281
bool update(THD *thd, set_var *var)
301
285
SHOW_TYPE show_type() { return SHOW_CHAR; }
302
unsigned char *value_ptr(THD *thd __attribute__((unused)),
303
enum_var_type type __attribute__((unused)),
304
LEX_STRING *base __attribute__((unused)))
286
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
306
return (unsigned char*) value;
288
return (uchar*) value;
308
bool check_update_type(Item_result type __attribute__((unused)))
290
bool check_update_type(Item_result type)
312
bool check_default(enum_var_type type __attribute__((unused)))
294
bool check_default(enum_var_type type) { return 1; }
314
295
bool is_readonly() const { return 1; }
322
303
sys_var_const_str_ptr(sys_var_chain *chain, const char *name_arg, char **value_arg)
323
304
:sys_var(name_arg),value(value_arg)
324
305
{ chain_sys_var(chain); }
325
bool check(THD *thd __attribute__((unused)),
326
set_var *var __attribute__((unused)))
306
bool check(THD *thd, set_var *var)
330
bool update(THD *thd __attribute__((unused)),
331
set_var *var __attribute__((unused)))
310
bool update(THD *thd, set_var *var)
335
314
SHOW_TYPE show_type() { return SHOW_CHAR; }
336
unsigned char *value_ptr(THD *thd __attribute__((unused)),
337
enum_var_type type __attribute__((unused)),
338
LEX_STRING *base __attribute__((unused)))
315
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
340
return (unsigned char*) *value;
317
return (uchar*) *value;
342
bool check_update_type(Item_result type __attribute__((unused)))
319
bool check_update_type(Item_result type)
346
bool check_default(enum_var_type type __attribute__((unused)))
348
bool is_readonly(void) const { return 1; }
323
bool check_default(enum_var_type type) { return 1; }
324
bool is_readonly() const { return 1; }
352
328
class sys_var_enum :public sys_var
355
331
TYPELIB *enum_names;
357
sys_var_enum(sys_var_chain *chain, const char *name_arg, uint32_t *value_arg,
333
sys_var_enum(sys_var_chain *chain, const char *name_arg, uint *value_arg,
358
334
TYPELIB *typelib, sys_after_update_func func)
359
335
:sys_var(name_arg,func), value(value_arg), enum_names(typelib)
360
336
{ chain_sys_var(chain); }
379
354
TYPELIB *typelib, sys_after_update_func func)
380
355
:sys_var(name_arg,func), offset(offset_arg), enum_names(typelib)
381
356
{ chain_sys_var(chain); }
382
bool check(THD *thd __attribute__((unused)),
383
set_var *var __attribute__((unused)))
385
bool update(THD *thd __attribute__((unused)),
386
set_var *var __attribute__((unused)))
357
bool check(THD *thd, set_var *var) { return 1; }
358
bool update(THD *thd, set_var *var) { return 1; }
388
359
SHOW_TYPE show_type() { return SHOW_CHAR; }
389
bool check_update_type(Item_result type __attribute__((unused)))
360
bool check_update_type(Item_result type) { return 1; }
391
361
bool is_readonly() const { return 1; }
392
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
362
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
447
416
bool update(THD *thd, set_var *var);
448
417
void set_default(THD *thd, enum_var_type type);
449
418
SHOW_TYPE show_type() { return SHOW_HA_ROWS; }
450
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
419
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
454
class sys_var_thd_uint64_t :public sys_var_thd
423
class sys_var_thd_ulonglong :public sys_var_thd
457
uint64_t SV::*offset;
426
ulonglong SV::*offset;
458
427
bool only_global;
459
sys_var_thd_uint64_t(sys_var_chain *chain, const char *name_arg,
460
uint64_t SV::*offset_arg)
428
sys_var_thd_ulonglong(sys_var_chain *chain, const char *name_arg,
429
ulonglong SV::*offset_arg)
461
430
:sys_var_thd(name_arg), offset(offset_arg)
462
431
{ chain_sys_var(chain); }
463
sys_var_thd_uint64_t(sys_var_chain *chain, const char *name_arg,
464
uint64_t SV::*offset_arg,
432
sys_var_thd_ulonglong(sys_var_chain *chain, const char *name_arg,
433
ulonglong SV::*offset_arg,
465
434
sys_after_update_func func, bool only_global_arg)
466
435
:sys_var_thd(name_arg, func), offset(offset_arg),
467
436
only_global(only_global_arg)
469
438
bool update(THD *thd, set_var *var);
470
439
void set_default(THD *thd, enum_var_type type);
471
440
SHOW_TYPE show_type() { return SHOW_LONGLONG; }
472
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
441
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
473
442
bool check(THD *thd, set_var *var);
474
443
bool check_default(enum_var_type type)
485
454
class sys_var_thd_bool :public sys_var_thd
489
sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, bool SV::*offset_arg)
458
sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, my_bool SV::*offset_arg)
490
459
:sys_var_thd(name_arg), offset(offset_arg)
491
460
{ chain_sys_var(chain); }
492
sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, bool SV::*offset_arg,
461
sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, my_bool SV::*offset_arg,
493
462
sys_after_update_func func)
494
463
:sys_var_thd(name_arg,func), offset(offset_arg)
495
464
{ chain_sys_var(chain); }
496
465
bool update(THD *thd, set_var *var);
497
466
void set_default(THD *thd, enum_var_type type);
498
467
SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
499
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
468
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
500
469
bool check(THD *thd, set_var *var)
502
471
return check_enum(thd, var, &bool_typelib);
504
bool check_update_type(Item_result type __attribute__((unused)))
473
bool check_update_type(Item_result type) { return 0; }
549
516
return check_set(thd, var, enum_names);
551
518
void set_default(THD *thd, enum_var_type type);
552
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
553
static bool symbolic_mode_representation(THD *thd, uint64_t sql_mode,
519
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
520
static bool symbolic_mode_representation(THD *thd, ulonglong sql_mode,
554
521
LEX_STRING *rep);
580
547
sys_check_func check_func;
581
548
sys_update_func update_func;
585
552
sys_var_thd_bit(sys_var_chain *chain, const char *name_arg,
586
553
sys_check_func c_func, sys_update_func u_func,
587
uint64_t bit, bool reverse_arg=0,
554
ulonglong bit, bool reverse_arg=0,
588
555
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
589
556
:sys_var_thd(name_arg, NULL, binlog_status_arg), check_func(c_func),
590
557
update_func(u_func), bit_flag(bit), reverse(reverse_arg)
591
558
{ chain_sys_var(chain); }
592
559
bool check(THD *thd, set_var *var);
593
560
bool update(THD *thd, set_var *var);
594
bool check_update_type(Item_result type __attribute__((unused)))
561
bool check_update_type(Item_result type) { return 0; }
596
562
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
597
563
SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
598
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
564
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
567
class sys_var_thd_dbug :public sys_var_thd
570
sys_var_thd_dbug(sys_var_chain *chain, const char *name_arg)
571
:sys_var_thd(name_arg)
572
{ chain_sys_var(chain); }
573
bool check_update_type(Item_result type) { return type != STRING_RESULT; }
574
SHOW_TYPE show_type() { return SHOW_CHAR; }
575
bool update(THD *thd, set_var *var);
576
void set_default(THD *thd, enum_var_type type) { DBUG_POP(); }
577
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *b);
601
582
/* some variables that require special handling */
610
591
bool update(THD *thd, set_var *var);
611
592
void set_default(THD *thd, enum_var_type type);
612
593
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
613
bool check_default(enum_var_type type __attribute__((unused)))
615
SHOW_TYPE show_type(void) { return SHOW_LONG; }
616
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
594
bool check_default(enum_var_type type) { return 0; }
595
SHOW_TYPE show_type() { return SHOW_LONG; }
596
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
707
687
return ((type != STRING_RESULT) && (type != INT_RESULT));
709
bool check_default(enum_var_type type __attribute__((unused)))
689
bool check_default(enum_var_type type) { return 0; }
711
690
bool update(THD *thd, set_var *var);
712
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
691
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
713
692
virtual void set_default(THD *thd, enum_var_type type)= 0;
714
virtual const CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0;
693
virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0;
696
class sys_var_character_set_sv :public sys_var_character_set
698
CHARSET_INFO *SV::*offset;
699
CHARSET_INFO **global_default;
701
sys_var_character_set_sv(sys_var_chain *chain, const char *name_arg,
702
CHARSET_INFO *SV::*offset_arg,
703
CHARSET_INFO **global_default_arg,
705
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
706
: sys_var_character_set(name_arg, is_nullable, binlog_status_arg),
707
offset(offset_arg), global_default(global_default_arg)
708
{ chain_sys_var(chain); }
709
void set_default(THD *thd, enum_var_type type);
710
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
714
class sys_var_character_set_client: public sys_var_character_set_sv
717
sys_var_character_set_client(sys_var_chain *chain, const char *name_arg,
718
CHARSET_INFO *SV::*offset_arg,
719
CHARSET_INFO **global_default_arg,
720
Binlog_status_enum binlog_status_arg)
721
: sys_var_character_set_sv(chain, name_arg, offset_arg, global_default_arg,
722
0, binlog_status_arg)
724
bool check(THD *thd, set_var *var);
728
class sys_var_character_set_database :public sys_var_character_set
731
sys_var_character_set_database(sys_var_chain *chain, const char *name_arg,
732
Binlog_status_enum binlog_status_arg=
734
: sys_var_character_set(name_arg, 0, binlog_status_arg)
735
{ chain_sys_var(chain); }
736
void set_default(THD *thd, enum_var_type type);
737
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
717
740
class sys_var_collation_sv :public sys_var_collation
719
const CHARSET_INFO *SV::*offset;
720
const CHARSET_INFO **global_default;
742
CHARSET_INFO *SV::*offset;
743
CHARSET_INFO **global_default;
722
745
sys_var_collation_sv(sys_var_chain *chain, const char *name_arg,
723
const CHARSET_INFO *SV::*offset_arg,
724
const CHARSET_INFO **global_default_arg,
746
CHARSET_INFO *SV::*offset_arg,
747
CHARSET_INFO **global_default_arg,
725
748
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
726
749
:sys_var_collation(name_arg, binlog_status_arg),
727
750
offset(offset_arg), global_default(global_default_arg)
776
798
class sys_var_thd_date_time_format :public sys_var_thd
778
800
DATE_TIME_FORMAT *SV::*offset;
779
enum enum_drizzle_timestamp_type date_time_type;
801
timestamp_type date_time_type;
781
803
sys_var_thd_date_time_format(sys_var_chain *chain, const char *name_arg,
782
804
DATE_TIME_FORMAT *SV::*offset_arg,
783
enum enum_drizzle_timestamp_type date_time_type_arg)
805
timestamp_type date_time_type_arg)
784
806
:sys_var_thd(name_arg), offset(offset_arg),
785
807
date_time_type(date_time_type_arg)
786
808
{ chain_sys_var(chain); }
790
812
return type != STRING_RESULT; /* Only accept strings */
792
bool check_default(enum_var_type type __attribute__((unused)))
814
bool check_default(enum_var_type type) { return 0; }
794
815
bool check(THD *thd, set_var *var);
795
816
bool update(THD *thd, set_var *var);
796
817
void update2(THD *thd, enum_var_type type, DATE_TIME_FORMAT *new_value);
797
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
818
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
798
819
void set_default(THD *thd, enum_var_type type);
802
823
class sys_var_log_state :public sys_var_bool_ptr
806
sys_var_log_state(sys_var_chain *chain, const char *name_arg, bool *value_arg,
807
uint32_t log_type_arg)
827
sys_var_log_state(sys_var_chain *chain, const char *name_arg, my_bool *value_arg,
808
829
:sys_var_bool_ptr(chain, name_arg, value_arg), log_type(log_type_arg) {}
809
830
bool update(THD *thd, set_var *var);
810
831
void set_default(THD *thd, enum_var_type type);
826
847
return check_set(thd, var, enum_names);
828
virtual void set_default(THD *thd __attribute__((unused)),
829
enum_var_type type __attribute__((unused)))
849
virtual void set_default(THD *thd, enum_var_type type)
833
853
bool update(THD *thd, set_var *var);
834
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
835
bool check_update_type(Item_result type __attribute__((unused)))
854
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
855
bool check_update_type(Item_result type) { return 0; }
837
856
SHOW_TYPE show_type() { return SHOW_CHAR; }
859
878
:sys_var(name_arg,func), value(value_arg), enum_names(typelib)
861
880
chain_sys_var(chain);
862
set_allow_empty_value(false);
881
set_allow_empty_value(FALSE);
864
883
virtual bool check(THD *thd, set_var *var)
866
885
return check_set(thd, var, enum_names);
868
887
bool update(THD *thd, set_var *var);
869
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
870
bool check_update_type(Item_result type __attribute__((unused)))
888
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
889
bool check_update_type(Item_result type) { return 0; }
872
890
void set_default(THD *thd, enum_var_type type);
873
891
SHOW_TYPE show_type() { return SHOW_CHAR; }
888
906
:sys_var(name_arg), var_type(type),
889
907
show_type_value(show_type_arg), value_ptr_func(value_ptr_func_arg)
890
908
{ chain_sys_var(chain); }
891
bool update(THD *thd __attribute__((unused)),
892
set_var *var __attribute__((unused)))
894
bool check_default(enum_var_type type __attribute__((unused)))
909
bool update(THD *thd, set_var *var) { return 1; }
910
bool check_default(enum_var_type type) { return 1; }
896
911
bool check_type(enum_var_type type) { return type != var_type; }
897
bool check_update_type(Item_result type __attribute__((unused)))
899
unsigned char *value_ptr(THD *thd, enum_var_type type __attribute__((unused)),
900
LEX_STRING *base __attribute__((unused)))
912
bool check_update_type(Item_result type) { return 1; }
913
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
902
915
return (*value_ptr_func)(thd);
904
SHOW_TYPE show_type(void) { return show_type_value; }
905
bool is_readonly(void) const { return 1; }
917
SHOW_TYPE show_type() { return show_type_value; }
918
bool is_readonly() const { return 1; }
914
927
sys_var_have_option(sys_var_chain *chain, const char *variable_name):
915
928
sys_var(variable_name)
916
929
{ chain_sys_var(chain); }
917
unsigned char *value_ptr(THD *thd __attribute__((unused)),
918
enum_var_type type __attribute__((unused)),
919
LEX_STRING *base __attribute__((unused)))
930
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
921
return (unsigned char*) show_comp_option_name[get_option()];
932
return (uchar*) show_comp_option_name[get_option()];
923
bool update(THD *thd __attribute__((unused)),
924
set_var *var __attribute__((unused))) { return 1; }
925
bool check_default(enum_var_type type __attribute__((unused)))
934
bool update(THD *thd, set_var *var) { return 1; }
935
bool check_default(enum_var_type type) { return 1; }
927
936
bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
928
bool check_update_type(Item_result type __attribute__((unused)))
937
bool check_update_type(Item_result type) { return 1; }
930
938
SHOW_TYPE show_type() { return SHOW_CHAR; }
931
939
bool is_readonly() const { return 1; }
949
957
class sys_var_have_plugin: public sys_var_have_option
951
959
const char *plugin_name_str;
952
const uint32_t plugin_name_len;
960
const uint plugin_name_len;
953
961
const int plugin_type;
956
964
sys_var_have_plugin(sys_var_chain *chain, const char *variable_name,
957
const char *plugin_name_str_arg, uint32_t plugin_name_len_arg,
965
const char *plugin_name_str_arg, uint plugin_name_len_arg,
958
966
int plugin_type_arg):
959
967
sys_var_have_option(chain, variable_name),
960
968
plugin_name_str(plugin_name_str_arg), plugin_name_len(plugin_name_len_arg),
1004
1011
void set_default(THD *thd, enum_var_type type);
1005
1012
SHOW_TYPE show_type() { return SHOW_INT; }
1006
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1013
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1010
1017
class sys_var_microseconds :public sys_var_thd
1012
uint64_t SV::*offset;
1019
ulonglong SV::*offset;
1014
1021
sys_var_microseconds(sys_var_chain *chain, const char *name_arg,
1015
uint64_t SV::*offset_arg):
1022
ulonglong SV::*offset_arg):
1016
1023
sys_var_thd(name_arg), offset(offset_arg)
1017
1024
{ chain_sys_var(chain); }
1018
bool check(THD *thd __attribute__((unused)),
1019
set_var *var __attribute__((unused))) {return 0;}
1025
bool check(THD *thd, set_var *var) {return 0;}
1020
1026
bool update(THD *thd, set_var *var);
1021
1027
void set_default(THD *thd, enum_var_type type);
1022
1028
SHOW_TYPE show_type() { return SHOW_DOUBLE; }
1025
1031
return (type != INT_RESULT && type != REAL_RESULT && type != DECIMAL_RESULT);
1027
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1033
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1037
class sys_var_trust_routine_creators :public sys_var_bool_ptr
1039
/* We need a derived class only to have a warn_deprecated() */
1041
sys_var_trust_routine_creators(sys_var_chain *chain,
1042
const char *name_arg, my_bool *value_arg) :
1043
sys_var_bool_ptr(chain, name_arg, value_arg) {};
1044
void warn_deprecated(THD *thd);
1045
void set_default(THD *thd, enum_var_type type);
1046
bool update(THD *thd, set_var *var);
1161
1179
class set_var_collation_client: public set_var_base
1163
const CHARSET_INFO *character_set_client;
1164
const CHARSET_INFO *character_set_results;
1165
const CHARSET_INFO *collation_connection;
1181
CHARSET_INFO *character_set_client;
1182
CHARSET_INFO *character_set_results;
1183
CHARSET_INFO *collation_connection;
1167
set_var_collation_client(const CHARSET_INFO * const client_coll_arg,
1168
const CHARSET_INFO * const connection_coll_arg,
1169
const CHARSET_INFO * const result_coll_arg)
1185
set_var_collation_client(CHARSET_INFO *client_coll_arg,
1186
CHARSET_INFO *connection_coll_arg,
1187
CHARSET_INFO *result_coll_arg)
1170
1188
:character_set_client(client_coll_arg),
1171
1189
character_set_results(result_coll_arg),
1172
1190
collation_connection(connection_coll_arg)
1186
1204
class NAMED_LIST :public ilink
1188
1206
const char *name;
1189
uint32_t name_length;
1191
unsigned char* data;
1193
1211
NAMED_LIST(I_List<NAMED_LIST> *links, const char *name_arg,
1194
uint32_t name_length_arg, unsigned char* data_arg)
1212
uint name_length_arg, uchar* data_arg)
1195
1213
:name_length(name_length_arg), data(data_arg)
1197
1215
name= my_strndup(name_arg, name_length, MYF(MY_WME));
1198
1216
links->push_back(this);
1200
inline bool cmp(const char *name_cmp, uint32_t length)
1218
inline bool cmp(const char *name_cmp, uint length)
1202
1220
return length == name_length && !memcmp(name, name_cmp, length);
1206
free((unsigned char*) name);
1224
my_free((uchar*) name, MYF(0));
1208
1226
friend bool process_key_caches(process_key_cache_t func);
1209
1227
friend void delete_elements(I_List<NAMED_LIST> *list,
1210
void (*free_element)(const char*, unsigned char*));
1228
void (*free_element)(const char*, uchar*));
1213
1231
/* updated in sql_acl.cc */
1215
1233
extern sys_var_thd_bool sys_old_alter_table;
1234
extern sys_var_thd_bool sys_old_passwords;
1216
1235
extern LEX_STRING default_key_cache_base;
1218
1237
/* For sql_yacc */
1229
1248
int set_var_init();
1230
1249
void set_var_free();
1231
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint32_t count);
1250
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint count);
1232
1251
SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted);
1233
1252
int mysql_add_sys_var_chain(sys_var *chain, struct my_option *long_options);
1234
1253
int mysql_del_sys_var_chain(sys_var *chain);
1235
sys_var *find_sys_var(THD *thd, const char *str, uint32_t length=0);
1254
sys_var *find_sys_var(THD *thd, const char *str, uint length=0);
1236
1255
int sql_set_variables(THD *thd, List<set_var_base> *var_list);
1237
1256
bool not_all_support_one_shot(List<set_var_base> *var_list);
1238
1257
void fix_delay_key_write(THD *thd, enum_var_type type);
1239
1258
void fix_slave_exec_mode(enum_var_type type);
1259
ulong fix_sql_mode(ulong sql_mode);
1260
extern sys_var_const_str sys_charset_system;
1240
1261
extern sys_var_str sys_init_connect;
1241
1262
extern sys_var_str sys_init_slave;
1242
1263
extern sys_var_thd_time_zone sys_time_zone;
1243
1264
extern sys_var_thd_bit sys_autocommit;
1244
const CHARSET_INFO *get_old_charset_by_name(const char *old_name);
1245
unsigned char* find_named(I_List<NAMED_LIST> *list, const char *name, uint32_t length,
1265
CHARSET_INFO *get_old_charset_by_name(const char *old_name);
1266
uchar* find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
1246
1267
NAMED_LIST **found);
1248
1269
extern sys_var_str sys_var_general_log_path, sys_var_slow_log_path;
1250
1271
/* key_cache functions */
1251
1272
KEY_CACHE *get_key_cache(LEX_STRING *cache_name);
1252
KEY_CACHE *get_or_create_key_cache(const char *name, uint32_t length);
1273
KEY_CACHE *get_or_create_key_cache(const char *name, uint length);
1253
1274
void free_key_cache(const char *name, KEY_CACHE *key_cache);
1254
1275
bool process_key_caches(process_key_cache_t func);
1255
1276
void delete_elements(I_List<NAMED_LIST> *list,
1256
void (*free_element)(const char*, unsigned char*));
1277
void (*free_element)(const char*, uchar*));