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 __attribute__((__unused__)),
99
enum_var_type type __attribute__((__unused__)))
102
101
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)))
102
virtual uchar *value_ptr(THD *thd __attribute__((__unused__)),
103
enum_var_type type __attribute__((__unused__)),
104
LEX_STRING *base __attribute__((__unused__)))
107
106
virtual bool check_type(enum_var_type type)
108
107
{ return type != OPT_GLOBAL; } /* Error if not GLOBAL */
109
108
virtual bool check_update_type(Item_result type)
110
109
{ return type != INT_RESULT; } /* Assume INT */
111
virtual bool check_default(enum_var_type type __attribute__((unused)))
110
virtual bool check_default(enum_var_type type __attribute__((__unused__)))
112
111
{ return option_limits == 0; }
113
112
Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
114
113
virtual bool is_struct() { return 0; }
164
163
bool update(THD *thd, set_var *var);
165
164
void set_default(THD *thd, enum_var_type type);
166
165
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; }
166
uchar *value_ptr(THD *thd __attribute__((__unused__)),
167
enum_var_type type __attribute__((__unused__)),
168
LEX_STRING *base __attribute__((__unused__)))
169
{ return (uchar*) value; }
186
class sys_var_uint64_t_ptr :public sys_var
185
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)
189
sys_var_ulonglong_ptr(sys_var_chain *chain, const char *name_arg, ulonglong *value_ptr_arg)
191
190
:sys_var(name_arg),value(value_ptr_arg)
192
191
{ chain_sys_var(chain); }
193
sys_var_uint64_t_ptr(sys_var_chain *chain, const char *name_arg, uint64_t *value_ptr_arg,
192
sys_var_ulonglong_ptr(sys_var_chain *chain, const char *name_arg, ulonglong *value_ptr_arg,
194
193
sys_after_update_func func)
195
194
:sys_var(name_arg,func), value(value_ptr_arg)
196
195
{ chain_sys_var(chain); }
197
196
bool update(THD *thd, set_var *var);
198
197
void set_default(THD *thd, enum_var_type type);
199
198
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; }
199
uchar *value_ptr(THD *thd __attribute__((__unused__)),
200
enum_var_type type __attribute__((__unused__)),
201
LEX_STRING *base __attribute__((__unused__)))
202
{ return (uchar*) value; }
207
206
class sys_var_bool_ptr :public sys_var
211
sys_var_bool_ptr(sys_var_chain *chain, const char *name_arg, bool *value_arg)
210
sys_var_bool_ptr(sys_var_chain *chain, const char *name_arg, my_bool *value_arg)
212
211
:sys_var(name_arg),value(value_arg)
213
212
{ chain_sys_var(chain); }
214
213
bool check(THD *thd, set_var *var)
218
217
bool update(THD *thd, set_var *var);
219
218
void set_default(THD *thd, enum_var_type type);
220
219
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)))
220
uchar *value_ptr(THD *thd __attribute__((__unused__)),
221
enum_var_type type __attribute__((__unused__)),
222
LEX_STRING *base __attribute__((__unused__)))
223
{ return (uchar*) value; }
224
bool check_update_type(Item_result type __attribute__((__unused__)))
229
229
class sys_var_bool_ptr_readonly :public sys_var_bool_ptr
232
232
sys_var_bool_ptr_readonly(sys_var_chain *chain, const char *name_arg,
234
234
:sys_var_bool_ptr(chain, name_arg, value_arg)
236
236
bool is_readonly() const { return 1; }
263
263
(*set_default_func)(thd, type);
265
265
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; }
266
uchar *value_ptr(THD *thd __attribute__((__unused__)),
267
enum_var_type type __attribute__((__unused__)),
268
LEX_STRING *base __attribute__((__unused__)))
269
{ return (uchar*) value; }
270
270
bool check_update_type(Item_result type)
272
272
return type != STRING_RESULT; /* Only accept strings */
274
bool check_default(enum_var_type type __attribute__((unused)))
274
bool check_default(enum_var_type type __attribute__((__unused__)))
289
289
value= new_value;
291
bool check(THD *thd __attribute__((unused)),
292
set_var *var __attribute__((unused)))
291
bool check(THD *thd __attribute__((__unused__)),
292
set_var *var __attribute__((__unused__)))
296
bool update(THD *thd __attribute__((unused)),
297
set_var *var __attribute__((unused)))
296
bool update(THD *thd __attribute__((__unused__)),
297
set_var *var __attribute__((__unused__)))
301
301
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)))
302
uchar *value_ptr(THD *thd __attribute__((__unused__)),
303
enum_var_type type __attribute__((__unused__)),
304
LEX_STRING *base __attribute__((__unused__)))
306
return (unsigned char*) value;
306
return (uchar*) value;
308
bool check_update_type(Item_result type __attribute__((unused)))
308
bool check_update_type(Item_result type __attribute__((__unused__)))
312
bool check_default(enum_var_type type __attribute__((unused)))
312
bool check_default(enum_var_type type __attribute__((__unused__)))
314
314
bool is_readonly() const { return 1; }
322
322
sys_var_const_str_ptr(sys_var_chain *chain, const char *name_arg, char **value_arg)
323
323
:sys_var(name_arg),value(value_arg)
324
324
{ chain_sys_var(chain); }
325
bool check(THD *thd __attribute__((unused)),
326
set_var *var __attribute__((unused)))
325
bool check(THD *thd __attribute__((__unused__)),
326
set_var *var __attribute__((__unused__)))
330
bool update(THD *thd __attribute__((unused)),
331
set_var *var __attribute__((unused)))
330
bool update(THD *thd __attribute__((__unused__)),
331
set_var *var __attribute__((__unused__)))
335
335
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)))
336
uchar *value_ptr(THD *thd __attribute__((__unused__)),
337
enum_var_type type __attribute__((__unused__)),
338
LEX_STRING *base __attribute__((__unused__)))
340
return (unsigned char*) *value;
340
return (uchar*) *value;
342
bool check_update_type(Item_result type __attribute__((unused)))
342
bool check_update_type(Item_result type __attribute__((__unused__)))
346
bool check_default(enum_var_type type __attribute__((unused)))
346
bool check_default(enum_var_type type __attribute__((__unused__)))
348
348
bool is_readonly(void) const { return 1; }
352
352
class sys_var_enum :public sys_var
355
355
TYPELIB *enum_names;
357
sys_var_enum(sys_var_chain *chain, const char *name_arg, uint32_t *value_arg,
357
sys_var_enum(sys_var_chain *chain, const char *name_arg, uint *value_arg,
358
358
TYPELIB *typelib, sys_after_update_func func)
359
359
:sys_var(name_arg,func), value(value_arg), enum_names(typelib)
360
360
{ chain_sys_var(chain); }
379
379
TYPELIB *typelib, sys_after_update_func func)
380
380
:sys_var(name_arg,func), offset(offset_arg), enum_names(typelib)
381
381
{ chain_sys_var(chain); }
382
bool check(THD *thd __attribute__((unused)),
383
set_var *var __attribute__((unused)))
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)))
385
bool update(THD *thd __attribute__((__unused__)),
386
set_var *var __attribute__((__unused__)))
388
388
SHOW_TYPE show_type() { return SHOW_CHAR; }
389
bool check_update_type(Item_result type __attribute__((unused)))
389
bool check_update_type(Item_result type __attribute__((__unused__)))
391
391
bool is_readonly() const { return 1; }
392
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
392
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
447
447
bool update(THD *thd, set_var *var);
448
448
void set_default(THD *thd, enum_var_type type);
449
449
SHOW_TYPE show_type() { return SHOW_HA_ROWS; }
450
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
450
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
454
class sys_var_thd_uint64_t :public sys_var_thd
454
class sys_var_thd_ulonglong :public sys_var_thd
457
uint64_t SV::*offset;
457
ulonglong SV::*offset;
458
458
bool only_global;
459
sys_var_thd_uint64_t(sys_var_chain *chain, const char *name_arg,
460
uint64_t SV::*offset_arg)
459
sys_var_thd_ulonglong(sys_var_chain *chain, const char *name_arg,
460
ulonglong SV::*offset_arg)
461
461
:sys_var_thd(name_arg), offset(offset_arg)
462
462
{ chain_sys_var(chain); }
463
sys_var_thd_uint64_t(sys_var_chain *chain, const char *name_arg,
464
uint64_t SV::*offset_arg,
463
sys_var_thd_ulonglong(sys_var_chain *chain, const char *name_arg,
464
ulonglong SV::*offset_arg,
465
465
sys_after_update_func func, bool only_global_arg)
466
466
:sys_var_thd(name_arg, func), offset(offset_arg),
467
467
only_global(only_global_arg)
469
469
bool update(THD *thd, set_var *var);
470
470
void set_default(THD *thd, enum_var_type type);
471
471
SHOW_TYPE show_type() { return SHOW_LONGLONG; }
472
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
472
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
473
473
bool check(THD *thd, set_var *var);
474
474
bool check_default(enum_var_type type)
485
485
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)
489
sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, my_bool SV::*offset_arg)
490
490
:sys_var_thd(name_arg), offset(offset_arg)
491
491
{ chain_sys_var(chain); }
492
sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, bool SV::*offset_arg,
492
sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, my_bool SV::*offset_arg,
493
493
sys_after_update_func func)
494
494
:sys_var_thd(name_arg,func), offset(offset_arg)
495
495
{ chain_sys_var(chain); }
496
496
bool update(THD *thd, set_var *var);
497
497
void set_default(THD *thd, enum_var_type type);
498
498
SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
499
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
499
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
500
500
bool check(THD *thd, set_var *var)
502
502
return check_enum(thd, var, &bool_typelib);
504
bool check_update_type(Item_result type __attribute__((unused)))
504
bool check_update_type(Item_result type __attribute__((__unused__)))
549
549
return check_set(thd, var, enum_names);
551
551
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,
552
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
553
static bool symbolic_mode_representation(THD *thd, ulonglong sql_mode,
554
554
LEX_STRING *rep);
580
580
sys_check_func check_func;
581
581
sys_update_func update_func;
585
585
sys_var_thd_bit(sys_var_chain *chain, const char *name_arg,
586
586
sys_check_func c_func, sys_update_func u_func,
587
uint64_t bit, bool reverse_arg=0,
587
ulonglong bit, bool reverse_arg=0,
588
588
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
589
589
:sys_var_thd(name_arg, NULL, binlog_status_arg), check_func(c_func),
590
590
update_func(u_func), bit_flag(bit), reverse(reverse_arg)
591
591
{ chain_sys_var(chain); }
592
592
bool check(THD *thd, set_var *var);
593
593
bool update(THD *thd, set_var *var);
594
bool check_update_type(Item_result type __attribute__((unused)))
594
bool check_update_type(Item_result type __attribute__((__unused__)))
596
596
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
597
597
SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
598
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
598
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
601
class sys_var_thd_dbug :public sys_var_thd
604
sys_var_thd_dbug(sys_var_chain *chain, const char *name_arg)
605
:sys_var_thd(name_arg)
606
{ chain_sys_var(chain); }
607
bool check_update_type(Item_result type) { return type != STRING_RESULT; }
608
SHOW_TYPE show_type() { return SHOW_CHAR; }
609
bool update(THD *thd, set_var *var);
610
void set_default(THD *thd __attribute__((__unused__)),
611
enum_var_type type __attribute__((__unused__)))
613
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *b);
601
618
/* some variables that require special handling */
610
627
bool update(THD *thd, set_var *var);
611
628
void set_default(THD *thd, enum_var_type type);
612
629
bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
613
bool check_default(enum_var_type type __attribute__((unused)))
630
bool check_default(enum_var_type type __attribute__((__unused__)))
615
632
SHOW_TYPE show_type(void) { return SHOW_LONG; }
616
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
633
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
707
724
return ((type != STRING_RESULT) && (type != INT_RESULT));
709
bool check_default(enum_var_type type __attribute__((unused)))
726
bool check_default(enum_var_type type __attribute__((__unused__)))
711
728
bool update(THD *thd, set_var *var);
712
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
729
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
713
730
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;
731
virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0;
734
class sys_var_character_set_sv :public sys_var_character_set
736
CHARSET_INFO *SV::*offset;
737
CHARSET_INFO **global_default;
739
sys_var_character_set_sv(sys_var_chain *chain, const char *name_arg,
740
CHARSET_INFO *SV::*offset_arg,
741
CHARSET_INFO **global_default_arg,
743
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
744
: sys_var_character_set(name_arg, is_nullable, binlog_status_arg),
745
offset(offset_arg), global_default(global_default_arg)
746
{ chain_sys_var(chain); }
747
void set_default(THD *thd, enum_var_type type);
748
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
752
class sys_var_character_set_client: public sys_var_character_set_sv
755
sys_var_character_set_client(sys_var_chain *chain, const char *name_arg,
756
CHARSET_INFO *SV::*offset_arg,
757
CHARSET_INFO **global_default_arg,
758
Binlog_status_enum binlog_status_arg)
759
: sys_var_character_set_sv(chain, name_arg, offset_arg, global_default_arg,
760
0, binlog_status_arg)
762
bool check(THD *thd, set_var *var);
766
class sys_var_character_set_database :public sys_var_character_set
769
sys_var_character_set_database(sys_var_chain *chain, const char *name_arg,
770
Binlog_status_enum binlog_status_arg=
772
: sys_var_character_set(name_arg, 0, binlog_status_arg)
773
{ chain_sys_var(chain); }
774
void set_default(THD *thd, enum_var_type type);
775
CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
717
778
class sys_var_collation_sv :public sys_var_collation
719
const CHARSET_INFO *SV::*offset;
720
const CHARSET_INFO **global_default;
780
CHARSET_INFO *SV::*offset;
781
CHARSET_INFO **global_default;
722
783
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,
784
CHARSET_INFO *SV::*offset_arg,
785
CHARSET_INFO **global_default_arg,
725
786
Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
726
787
:sys_var_collation(name_arg, binlog_status_arg),
727
788
offset(offset_arg), global_default(global_default_arg)
776
837
class sys_var_thd_date_time_format :public sys_var_thd
778
839
DATE_TIME_FORMAT *SV::*offset;
779
enum enum_drizzle_timestamp_type date_time_type;
840
timestamp_type date_time_type;
781
842
sys_var_thd_date_time_format(sys_var_chain *chain, const char *name_arg,
782
843
DATE_TIME_FORMAT *SV::*offset_arg,
783
enum enum_drizzle_timestamp_type date_time_type_arg)
844
timestamp_type date_time_type_arg)
784
845
:sys_var_thd(name_arg), offset(offset_arg),
785
846
date_time_type(date_time_type_arg)
786
847
{ chain_sys_var(chain); }
790
851
return type != STRING_RESULT; /* Only accept strings */
792
bool check_default(enum_var_type type __attribute__((unused)))
853
bool check_default(enum_var_type type __attribute__((__unused__)))
794
855
bool check(THD *thd, set_var *var);
795
856
bool update(THD *thd, set_var *var);
796
857
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);
858
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
798
859
void set_default(THD *thd, enum_var_type type);
802
863
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)
867
sys_var_log_state(sys_var_chain *chain, const char *name_arg, my_bool *value_arg,
808
869
:sys_var_bool_ptr(chain, name_arg, value_arg), log_type(log_type_arg) {}
809
870
bool update(THD *thd, set_var *var);
810
871
void set_default(THD *thd, enum_var_type type);
826
887
return check_set(thd, var, enum_names);
828
virtual void set_default(THD *thd __attribute__((unused)),
829
enum_var_type type __attribute__((unused)))
889
virtual void set_default(THD *thd __attribute__((__unused__)),
890
enum_var_type type __attribute__((__unused__)))
833
894
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)))
895
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
896
bool check_update_type(Item_result type __attribute__((__unused__)))
837
898
SHOW_TYPE show_type() { return SHOW_CHAR; }
859
920
:sys_var(name_arg,func), value(value_arg), enum_names(typelib)
861
922
chain_sys_var(chain);
862
set_allow_empty_value(false);
923
set_allow_empty_value(FALSE);
864
925
virtual bool check(THD *thd, set_var *var)
866
927
return check_set(thd, var, enum_names);
868
929
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)))
930
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
931
bool check_update_type(Item_result type __attribute__((__unused__)))
872
933
void set_default(THD *thd, enum_var_type type);
873
934
SHOW_TYPE show_type() { return SHOW_CHAR; }
888
949
:sys_var(name_arg), var_type(type),
889
950
show_type_value(show_type_arg), value_ptr_func(value_ptr_func_arg)
890
951
{ chain_sys_var(chain); }
891
bool update(THD *thd __attribute__((unused)),
892
set_var *var __attribute__((unused)))
952
bool update(THD *thd __attribute__((__unused__)),
953
set_var *var __attribute__((__unused__)))
894
bool check_default(enum_var_type type __attribute__((unused)))
955
bool check_default(enum_var_type type __attribute__((__unused__)))
896
957
bool check_type(enum_var_type type) { return type != var_type; }
897
bool check_update_type(Item_result type __attribute__((unused)))
958
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)))
960
uchar *value_ptr(THD *thd, enum_var_type type __attribute__((__unused__)),
961
LEX_STRING *base __attribute__((__unused__)))
902
963
return (*value_ptr_func)(thd);
914
975
sys_var_have_option(sys_var_chain *chain, const char *variable_name):
915
976
sys_var(variable_name)
916
977
{ 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)))
978
uchar *value_ptr(THD *thd __attribute__((__unused__)),
979
enum_var_type type __attribute__((__unused__)),
980
LEX_STRING *base __attribute__((__unused__)))
921
return (unsigned char*) show_comp_option_name[get_option()];
982
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)))
984
bool update(THD *thd __attribute__((__unused__)),
985
set_var *var __attribute__((__unused__))) { return 1; }
986
bool check_default(enum_var_type type __attribute__((__unused__)))
927
988
bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
928
bool check_update_type(Item_result type __attribute__((unused)))
989
bool check_update_type(Item_result type __attribute__((__unused__)))
930
991
SHOW_TYPE show_type() { return SHOW_CHAR; }
931
992
bool is_readonly() const { return 1; }
949
1010
class sys_var_have_plugin: public sys_var_have_option
951
1012
const char *plugin_name_str;
952
const uint32_t plugin_name_len;
1013
const uint plugin_name_len;
953
1014
const int plugin_type;
956
1017
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,
1018
const char *plugin_name_str_arg, uint plugin_name_len_arg,
958
1019
int plugin_type_arg):
959
1020
sys_var_have_option(chain, variable_name),
960
1021
plugin_name_str(plugin_name_str_arg), plugin_name_len(plugin_name_len_arg),
1004
1065
void set_default(THD *thd, enum_var_type type);
1005
1066
SHOW_TYPE show_type() { return SHOW_INT; }
1006
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1067
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1010
1071
class sys_var_microseconds :public sys_var_thd
1012
uint64_t SV::*offset;
1073
ulonglong SV::*offset;
1014
1075
sys_var_microseconds(sys_var_chain *chain, const char *name_arg,
1015
uint64_t SV::*offset_arg):
1076
ulonglong SV::*offset_arg):
1016
1077
sys_var_thd(name_arg), offset(offset_arg)
1017
1078
{ chain_sys_var(chain); }
1018
bool check(THD *thd __attribute__((unused)),
1019
set_var *var __attribute__((unused))) {return 0;}
1079
bool check(THD *thd __attribute__((__unused__)),
1080
set_var *var __attribute__((__unused__))) {return 0;}
1020
1081
bool update(THD *thd, set_var *var);
1021
1082
void set_default(THD *thd, enum_var_type type);
1022
1083
SHOW_TYPE show_type() { return SHOW_DOUBLE; }
1025
1086
return (type != INT_RESULT && type != REAL_RESULT && type != DECIMAL_RESULT);
1027
unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1088
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1092
class sys_var_trust_routine_creators :public sys_var_bool_ptr
1094
/* We need a derived class only to have a warn_deprecated() */
1096
sys_var_trust_routine_creators(sys_var_chain *chain,
1097
const char *name_arg, my_bool *value_arg) :
1098
sys_var_bool_ptr(chain, name_arg, value_arg) {};
1099
void warn_deprecated(THD *thd);
1100
void set_default(THD *thd, enum_var_type type);
1101
bool update(THD *thd, set_var *var);
1161
1235
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;
1237
CHARSET_INFO *character_set_client;
1238
CHARSET_INFO *character_set_results;
1239
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)
1241
set_var_collation_client(CHARSET_INFO *client_coll_arg,
1242
CHARSET_INFO *connection_coll_arg,
1243
CHARSET_INFO *result_coll_arg)
1170
1244
:character_set_client(client_coll_arg),
1171
1245
character_set_results(result_coll_arg),
1172
1246
collation_connection(connection_coll_arg)
1186
1260
class NAMED_LIST :public ilink
1188
1262
const char *name;
1189
uint32_t name_length;
1191
unsigned char* data;
1193
1267
NAMED_LIST(I_List<NAMED_LIST> *links, const char *name_arg,
1194
uint32_t name_length_arg, unsigned char* data_arg)
1268
uint name_length_arg, uchar* data_arg)
1195
1269
:name_length(name_length_arg), data(data_arg)
1197
1271
name= my_strndup(name_arg, name_length, MYF(MY_WME));
1198
1272
links->push_back(this);
1200
inline bool cmp(const char *name_cmp, uint32_t length)
1274
inline bool cmp(const char *name_cmp, uint length)
1202
1276
return length == name_length && !memcmp(name, name_cmp, length);
1206
free((unsigned char*) name);
1280
my_free((uchar*) name, MYF(0));
1208
1282
friend bool process_key_caches(process_key_cache_t func);
1209
1283
friend void delete_elements(I_List<NAMED_LIST> *list,
1210
void (*free_element)(const char*, unsigned char*));
1284
void (*free_element)(const char*, uchar*));
1213
1287
/* updated in sql_acl.cc */
1215
1289
extern sys_var_thd_bool sys_old_alter_table;
1290
extern sys_var_thd_bool sys_old_passwords;
1216
1291
extern LEX_STRING default_key_cache_base;
1218
1293
/* For sql_yacc */
1229
1304
int set_var_init();
1230
1305
void set_var_free();
1231
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint32_t count);
1306
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint count);
1232
1307
SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted);
1233
1308
int mysql_add_sys_var_chain(sys_var *chain, struct my_option *long_options);
1234
1309
int mysql_del_sys_var_chain(sys_var *chain);
1235
sys_var *find_sys_var(THD *thd, const char *str, uint32_t length=0);
1310
sys_var *find_sys_var(THD *thd, const char *str, uint length=0);
1236
1311
int sql_set_variables(THD *thd, List<set_var_base> *var_list);
1237
1312
bool not_all_support_one_shot(List<set_var_base> *var_list);
1238
1313
void fix_delay_key_write(THD *thd, enum_var_type type);
1239
1314
void fix_slave_exec_mode(enum_var_type type);
1315
ulong fix_sql_mode(ulong sql_mode);
1316
extern sys_var_const_str sys_charset_system;
1240
1317
extern sys_var_str sys_init_connect;
1241
1318
extern sys_var_str sys_init_slave;
1242
1319
extern sys_var_thd_time_zone sys_time_zone;
1243
1320
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,
1321
CHARSET_INFO *get_old_charset_by_name(const char *old_name);
1322
uchar* find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
1246
1323
NAMED_LIST **found);
1248
1325
extern sys_var_str sys_var_general_log_path, sys_var_slow_log_path;
1250
1327
/* key_cache functions */
1251
1328
KEY_CACHE *get_key_cache(LEX_STRING *cache_name);
1252
KEY_CACHE *get_or_create_key_cache(const char *name, uint32_t length);
1329
KEY_CACHE *get_or_create_key_cache(const char *name, uint length);
1253
1330
void free_key_cache(const char *name, KEY_CACHE *key_cache);
1254
1331
bool process_key_caches(process_key_cache_t func);
1255
1332
void delete_elements(I_List<NAMED_LIST> *list,
1256
void (*free_element)(const char*, unsigned char*));
1333
void (*free_element)(const char*, uchar*));