143
144
fix_completion_type);
144
145
static sys_var_collation_sv
145
146
sys_collation_server(&vars, "collation_server", &system_variables::collation_server, &default_charset_info);
146
static sys_var_const_str sys_datadir(&vars, "datadir", drizzle_real_data_home);
147
static sys_var_const_str sys_datadir(&vars, "datadir", data_home_real);
148
149
static sys_var_session_uint64_t sys_join_buffer_size(&vars, "join_buffer_size",
149
150
&system_variables::join_buff_size);
200
201
static sys_var_const_str_ptr sys_secure_file_priv(&vars, "secure_file_priv",
201
202
&opt_secure_file_priv);
204
static sys_var_const_str_ptr sys_scheduler(&vars, "scheduler",
202
207
static sys_var_uint32_t_ptr sys_server_id(&vars, "server_id", &server_id,
399
404
static void fix_session_mem_root(Session *session, sql_var_t type)
401
406
if (type != OPT_GLOBAL)
402
reset_root_defaults(session->mem_root,
403
session->variables.query_alloc_block_size,
404
session->variables.query_prealloc_size);
407
session->mem_root->reset_root_defaults(session->variables.query_alloc_block_size,
408
session->variables.query_prealloc_size);
500
504
bool sys_var_uint32_t_ptr::update(Session *session, set_var *var)
502
506
uint32_t tmp= var->save_result.uint32_t_value;
503
pthread_mutex_lock(&LOCK_global_system_variables);
507
LOCK_global_system_variables.lock();
504
508
if (option_limits)
506
510
uint32_t newvalue= (uint32_t) fix_unsigned(session, tmp, option_limits);
517
521
void sys_var_uint32_t_ptr::set_default(Session *, sql_var_t)
520
pthread_mutex_lock(&LOCK_global_system_variables);
524
LOCK_global_system_variables.lock();
521
525
*value= (uint32_t)getopt_ull_limit_value((uint32_t) option_limits->def_value,
522
526
option_limits, ¬_used);
523
pthread_mutex_unlock(&LOCK_global_system_variables);
527
LOCK_global_system_variables.unlock();
527
531
bool sys_var_uint64_t_ptr::update(Session *session, set_var *var)
529
533
uint64_t tmp= var->save_result.uint64_t_value;
530
pthread_mutex_lock(&LOCK_global_system_variables);
534
LOCK_global_system_variables.lock();
531
535
if (option_limits)
533
537
uint64_t newvalue= (uint64_t) fix_unsigned(session, tmp, option_limits);
544
548
void sys_var_uint64_t_ptr::set_default(Session *, sql_var_t)
547
pthread_mutex_lock(&LOCK_global_system_variables);
551
LOCK_global_system_variables.lock();
548
552
*value= getopt_ull_limit_value((uint64_t) option_limits->def_value,
549
553
option_limits, ¬_used);
550
pthread_mutex_unlock(&LOCK_global_system_variables);
554
LOCK_global_system_variables.unlock();
554
558
bool sys_var_size_t_ptr::update(Session *session, set_var *var)
556
560
size_t tmp= var->save_result.size_t_value;
557
pthread_mutex_lock(&LOCK_global_system_variables);
561
LOCK_global_system_variables.lock();
558
562
if (option_limits)
559
563
*value= fix_size_t(session, tmp, option_limits);
562
pthread_mutex_unlock(&LOCK_global_system_variables);
566
LOCK_global_system_variables.unlock();
567
571
void sys_var_size_t_ptr::set_default(Session *, sql_var_t)
570
pthread_mutex_lock(&LOCK_global_system_variables);
574
LOCK_global_system_variables.lock();
571
575
*value= (size_t)getopt_ull_limit_value((size_t) option_limits->def_value,
572
576
option_limits, ¬_used);
573
pthread_mutex_unlock(&LOCK_global_system_variables);
577
LOCK_global_system_variables.unlock();
576
580
bool sys_var_bool_ptr::update(Session *, set_var *var)
661
665
if (var->type == OPT_GLOBAL)
663
667
/* Lock is needed to make things safe on 32 bit systems */
664
pthread_mutex_lock(&LOCK_global_system_variables);
668
LOCK_global_system_variables.lock();
665
669
global_system_variables.*offset= (ha_rows) tmp;
666
pthread_mutex_unlock(&LOCK_global_system_variables);
670
LOCK_global_system_variables.unlock();
669
673
session->variables.*offset= (ha_rows) tmp;
679
683
/* We will not come here if option_limits is not set */
680
pthread_mutex_lock(&LOCK_global_system_variables);
684
LOCK_global_system_variables.lock();
681
685
global_system_variables.*offset=
682
686
(ha_rows) getopt_ull_limit_value((ha_rows) option_limits->def_value,
683
687
option_limits, ¬_used);
684
pthread_mutex_unlock(&LOCK_global_system_variables);
688
LOCK_global_system_variables.unlock();
687
691
session->variables.*offset= global_system_variables.*offset;
718
722
if (var->type == OPT_GLOBAL)
720
724
/* Lock is needed to make things safe on 32 bit systems */
721
pthread_mutex_lock(&LOCK_global_system_variables);
725
LOCK_global_system_variables.lock();
722
726
global_system_variables.*offset= (uint64_t) tmp;
723
pthread_mutex_unlock(&LOCK_global_system_variables);
727
LOCK_global_system_variables.unlock();
726
730
session->variables.*offset= (uint64_t) tmp;
733
737
if (type == OPT_GLOBAL)
736
pthread_mutex_lock(&LOCK_global_system_variables);
740
LOCK_global_system_variables.lock();
737
741
global_system_variables.*offset=
738
742
getopt_ull_limit_value((uint64_t) option_limits->def_value,
739
743
option_limits, ¬_used);
740
pthread_mutex_unlock(&LOCK_global_system_variables);
744
LOCK_global_system_variables.unlock();
743
747
session->variables.*offset= global_system_variables.*offset;
771
775
if (var->type == OPT_GLOBAL)
773
777
/* Lock is needed to make things safe on 32 bit systems */
774
pthread_mutex_lock(&LOCK_global_system_variables);
778
LOCK_global_system_variables.lock();
775
779
global_system_variables.*offset= tmp;
776
pthread_mutex_unlock(&LOCK_global_system_variables);
780
LOCK_global_system_variables.unlock();
779
783
session->variables.*offset= tmp;
786
790
if (type == OPT_GLOBAL)
789
pthread_mutex_lock(&LOCK_global_system_variables);
793
LOCK_global_system_variables.lock();
790
794
global_system_variables.*offset=
791
795
(size_t)getopt_ull_limit_value((size_t) option_limits->def_value,
792
796
option_limits, ¬_used);
793
pthread_mutex_unlock(&LOCK_global_system_variables);
797
LOCK_global_system_variables.unlock();
796
800
session->variables.*offset= global_system_variables.*offset;
903
pthread_mutex_lock(&LOCK_global_system_variables);
907
LOCK_global_system_variables.lock();
904
908
value= *(uint*) value_ptr(session, var_type, base);
905
pthread_mutex_unlock(&LOCK_global_system_variables);
909
LOCK_global_system_variables.unlock();
906
910
return new Item_uint((uint64_t) value);
908
912
case SHOW_LONGLONG:
911
pthread_mutex_lock(&LOCK_global_system_variables);
915
LOCK_global_system_variables.lock();
912
916
value= *(int64_t*) value_ptr(session, var_type, base);
913
pthread_mutex_unlock(&LOCK_global_system_variables);
917
LOCK_global_system_variables.unlock();
914
918
return new Item_int(value);
916
920
case SHOW_DOUBLE:
919
pthread_mutex_lock(&LOCK_global_system_variables);
923
LOCK_global_system_variables.lock();
920
924
value= *(double*) value_ptr(session, var_type, base);
921
pthread_mutex_unlock(&LOCK_global_system_variables);
925
LOCK_global_system_variables.unlock();
922
926
/* 6, as this is for now only used with microseconds */
923
927
return new Item_float(value, 6);
925
929
case SHOW_HA_ROWS:
928
pthread_mutex_lock(&LOCK_global_system_variables);
932
LOCK_global_system_variables.lock();
929
933
value= *(ha_rows*) value_ptr(session, var_type, base);
930
pthread_mutex_unlock(&LOCK_global_system_variables);
934
LOCK_global_system_variables.unlock();
931
935
return new Item_int((uint64_t) value);
936
pthread_mutex_lock(&LOCK_global_system_variables);
940
LOCK_global_system_variables.lock();
937
941
value= *(size_t*) value_ptr(session, var_type, base);
938
pthread_mutex_unlock(&LOCK_global_system_variables);
942
LOCK_global_system_variables.unlock();
939
943
return new Item_int((uint64_t) value);
941
945
case SHOW_MY_BOOL:
944
pthread_mutex_lock(&LOCK_global_system_variables);
948
LOCK_global_system_variables.lock();
945
949
value= *(bool*) value_ptr(session, var_type, base);
946
pthread_mutex_unlock(&LOCK_global_system_variables);
950
LOCK_global_system_variables.unlock();
947
951
return new Item_int(value,1);
949
953
case SHOW_CHAR_PTR:
952
pthread_mutex_lock(&LOCK_global_system_variables);
956
LOCK_global_system_variables.lock();
953
957
char *str= *(char**) value_ptr(session, var_type, base);
962
966
tmp= new Item_null();
963
967
tmp->collation.set(system_charset_info, DERIVATION_SYSCONST);
965
pthread_mutex_unlock(&LOCK_global_system_variables);
969
LOCK_global_system_variables.unlock();
971
pthread_mutex_lock(&LOCK_global_system_variables);
975
LOCK_global_system_variables.lock();
972
976
char *str= (char*) value_ptr(session, var_type, base);
974
978
tmp= new Item_string(str, strlen(str),
1181
1185
/* We are using Time_zone object found during check() phase. */
1182
1186
if (var->type == OPT_GLOBAL)
1184
pthread_mutex_lock(&LOCK_global_system_variables);
1188
LOCK_global_system_variables.lock();
1185
1189
global_system_variables.time_zone= var->save_result.time_zone;
1186
pthread_mutex_unlock(&LOCK_global_system_variables);
1190
LOCK_global_system_variables.unlock();
1189
1193
session->variables.time_zone= var->save_result.time_zone;
1324
1328
microseconds= (int64_t) (num * 1000000.0 + 0.5);
1325
1329
if (var->type == OPT_GLOBAL)
1327
pthread_mutex_lock(&LOCK_global_system_variables);
1331
LOCK_global_system_variables.lock();
1328
1332
(global_system_variables.*offset)= microseconds;
1329
pthread_mutex_unlock(&LOCK_global_system_variables);
1333
LOCK_global_system_variables.unlock();
1332
1336
session->variables.*offset= microseconds;
1339
1343
int64_t microseconds= (int64_t) (option_limits->def_value * 1000000.0);
1340
1344
if (type == OPT_GLOBAL)
1342
pthread_mutex_lock(&LOCK_global_system_variables);
1346
LOCK_global_system_variables.lock();
1343
1347
global_system_variables.*offset= microseconds;
1344
pthread_mutex_unlock(&LOCK_global_system_variables);
1348
LOCK_global_system_variables.unlock();
1347
1351
session->variables.*offset= microseconds;