504
504
bool sys_var_uint32_t_ptr::update(Session *session, set_var *var)
506
506
uint32_t tmp= var->save_result.uint32_t_value;
507
pthread_mutex_lock(&LOCK_global_system_variables);
507
LOCK_global_system_variables.lock();
508
508
if (option_limits)
510
510
uint32_t newvalue= (uint32_t) fix_unsigned(session, tmp, option_limits);
521
521
void sys_var_uint32_t_ptr::set_default(Session *, sql_var_t)
524
pthread_mutex_lock(&LOCK_global_system_variables);
524
LOCK_global_system_variables.lock();
525
525
*value= (uint32_t)getopt_ull_limit_value((uint32_t) option_limits->def_value,
526
526
option_limits, ¬_used);
527
pthread_mutex_unlock(&LOCK_global_system_variables);
527
LOCK_global_system_variables.unlock();
531
531
bool sys_var_uint64_t_ptr::update(Session *session, set_var *var)
533
533
uint64_t tmp= var->save_result.uint64_t_value;
534
pthread_mutex_lock(&LOCK_global_system_variables);
534
LOCK_global_system_variables.lock();
535
535
if (option_limits)
537
537
uint64_t newvalue= (uint64_t) fix_unsigned(session, tmp, option_limits);
548
548
void sys_var_uint64_t_ptr::set_default(Session *, sql_var_t)
551
pthread_mutex_lock(&LOCK_global_system_variables);
551
LOCK_global_system_variables.lock();
552
552
*value= getopt_ull_limit_value((uint64_t) option_limits->def_value,
553
553
option_limits, ¬_used);
554
pthread_mutex_unlock(&LOCK_global_system_variables);
554
LOCK_global_system_variables.unlock();
558
558
bool sys_var_size_t_ptr::update(Session *session, set_var *var)
560
560
size_t tmp= var->save_result.size_t_value;
561
pthread_mutex_lock(&LOCK_global_system_variables);
561
LOCK_global_system_variables.lock();
562
562
if (option_limits)
563
563
*value= fix_size_t(session, tmp, option_limits);
566
pthread_mutex_unlock(&LOCK_global_system_variables);
566
LOCK_global_system_variables.unlock();
571
571
void sys_var_size_t_ptr::set_default(Session *, sql_var_t)
574
pthread_mutex_lock(&LOCK_global_system_variables);
574
LOCK_global_system_variables.lock();
575
575
*value= (size_t)getopt_ull_limit_value((size_t) option_limits->def_value,
576
576
option_limits, ¬_used);
577
pthread_mutex_unlock(&LOCK_global_system_variables);
577
LOCK_global_system_variables.unlock();
580
580
bool sys_var_bool_ptr::update(Session *, set_var *var)
665
665
if (var->type == OPT_GLOBAL)
667
667
/* Lock is needed to make things safe on 32 bit systems */
668
pthread_mutex_lock(&LOCK_global_system_variables);
668
LOCK_global_system_variables.lock();
669
669
global_system_variables.*offset= (ha_rows) tmp;
670
pthread_mutex_unlock(&LOCK_global_system_variables);
670
LOCK_global_system_variables.unlock();
673
673
session->variables.*offset= (ha_rows) tmp;
683
683
/* We will not come here if option_limits is not set */
684
pthread_mutex_lock(&LOCK_global_system_variables);
684
LOCK_global_system_variables.lock();
685
685
global_system_variables.*offset=
686
686
(ha_rows) getopt_ull_limit_value((ha_rows) option_limits->def_value,
687
687
option_limits, ¬_used);
688
pthread_mutex_unlock(&LOCK_global_system_variables);
688
LOCK_global_system_variables.unlock();
691
691
session->variables.*offset= global_system_variables.*offset;
722
722
if (var->type == OPT_GLOBAL)
724
724
/* Lock is needed to make things safe on 32 bit systems */
725
pthread_mutex_lock(&LOCK_global_system_variables);
725
LOCK_global_system_variables.lock();
726
726
global_system_variables.*offset= (uint64_t) tmp;
727
pthread_mutex_unlock(&LOCK_global_system_variables);
727
LOCK_global_system_variables.unlock();
730
730
session->variables.*offset= (uint64_t) tmp;
737
737
if (type == OPT_GLOBAL)
740
pthread_mutex_lock(&LOCK_global_system_variables);
740
LOCK_global_system_variables.lock();
741
741
global_system_variables.*offset=
742
742
getopt_ull_limit_value((uint64_t) option_limits->def_value,
743
743
option_limits, ¬_used);
744
pthread_mutex_unlock(&LOCK_global_system_variables);
744
LOCK_global_system_variables.unlock();
747
747
session->variables.*offset= global_system_variables.*offset;
775
775
if (var->type == OPT_GLOBAL)
777
777
/* Lock is needed to make things safe on 32 bit systems */
778
pthread_mutex_lock(&LOCK_global_system_variables);
778
LOCK_global_system_variables.lock();
779
779
global_system_variables.*offset= tmp;
780
pthread_mutex_unlock(&LOCK_global_system_variables);
780
LOCK_global_system_variables.unlock();
783
783
session->variables.*offset= tmp;
790
790
if (type == OPT_GLOBAL)
793
pthread_mutex_lock(&LOCK_global_system_variables);
793
LOCK_global_system_variables.lock();
794
794
global_system_variables.*offset=
795
795
(size_t)getopt_ull_limit_value((size_t) option_limits->def_value,
796
796
option_limits, ¬_used);
797
pthread_mutex_unlock(&LOCK_global_system_variables);
797
LOCK_global_system_variables.unlock();
800
800
session->variables.*offset= global_system_variables.*offset;
907
pthread_mutex_lock(&LOCK_global_system_variables);
907
LOCK_global_system_variables.lock();
908
908
value= *(uint*) value_ptr(session, var_type, base);
909
pthread_mutex_unlock(&LOCK_global_system_variables);
909
LOCK_global_system_variables.unlock();
910
910
return new Item_uint((uint64_t) value);
912
912
case SHOW_LONGLONG:
915
pthread_mutex_lock(&LOCK_global_system_variables);
915
LOCK_global_system_variables.lock();
916
916
value= *(int64_t*) value_ptr(session, var_type, base);
917
pthread_mutex_unlock(&LOCK_global_system_variables);
917
LOCK_global_system_variables.unlock();
918
918
return new Item_int(value);
920
920
case SHOW_DOUBLE:
923
pthread_mutex_lock(&LOCK_global_system_variables);
923
LOCK_global_system_variables.lock();
924
924
value= *(double*) value_ptr(session, var_type, base);
925
pthread_mutex_unlock(&LOCK_global_system_variables);
925
LOCK_global_system_variables.unlock();
926
926
/* 6, as this is for now only used with microseconds */
927
927
return new Item_float(value, 6);
929
929
case SHOW_HA_ROWS:
932
pthread_mutex_lock(&LOCK_global_system_variables);
932
LOCK_global_system_variables.lock();
933
933
value= *(ha_rows*) value_ptr(session, var_type, base);
934
pthread_mutex_unlock(&LOCK_global_system_variables);
934
LOCK_global_system_variables.unlock();
935
935
return new Item_int((uint64_t) value);
940
pthread_mutex_lock(&LOCK_global_system_variables);
940
LOCK_global_system_variables.lock();
941
941
value= *(size_t*) value_ptr(session, var_type, base);
942
pthread_mutex_unlock(&LOCK_global_system_variables);
942
LOCK_global_system_variables.unlock();
943
943
return new Item_int((uint64_t) value);
945
945
case SHOW_MY_BOOL:
948
pthread_mutex_lock(&LOCK_global_system_variables);
948
LOCK_global_system_variables.lock();
949
949
value= *(bool*) value_ptr(session, var_type, base);
950
pthread_mutex_unlock(&LOCK_global_system_variables);
950
LOCK_global_system_variables.unlock();
951
951
return new Item_int(value,1);
953
953
case SHOW_CHAR_PTR:
956
pthread_mutex_lock(&LOCK_global_system_variables);
956
LOCK_global_system_variables.lock();
957
957
char *str= *(char**) value_ptr(session, var_type, base);
966
966
tmp= new Item_null();
967
967
tmp->collation.set(system_charset_info, DERIVATION_SYSCONST);
969
pthread_mutex_unlock(&LOCK_global_system_variables);
969
LOCK_global_system_variables.unlock();
975
pthread_mutex_lock(&LOCK_global_system_variables);
975
LOCK_global_system_variables.lock();
976
976
char *str= (char*) value_ptr(session, var_type, base);
978
978
tmp= new Item_string(str, strlen(str),
1185
1185
/* We are using Time_zone object found during check() phase. */
1186
1186
if (var->type == OPT_GLOBAL)
1188
pthread_mutex_lock(&LOCK_global_system_variables);
1188
LOCK_global_system_variables.lock();
1189
1189
global_system_variables.time_zone= var->save_result.time_zone;
1190
pthread_mutex_unlock(&LOCK_global_system_variables);
1190
LOCK_global_system_variables.unlock();
1193
1193
session->variables.time_zone= var->save_result.time_zone;
1328
1328
microseconds= (int64_t) (num * 1000000.0 + 0.5);
1329
1329
if (var->type == OPT_GLOBAL)
1331
pthread_mutex_lock(&LOCK_global_system_variables);
1331
LOCK_global_system_variables.lock();
1332
1332
(global_system_variables.*offset)= microseconds;
1333
pthread_mutex_unlock(&LOCK_global_system_variables);
1333
LOCK_global_system_variables.unlock();
1336
1336
session->variables.*offset= microseconds;
1343
1343
int64_t microseconds= (int64_t) (option_limits->def_value * 1000000.0);
1344
1344
if (type == OPT_GLOBAL)
1346
pthread_mutex_lock(&LOCK_global_system_variables);
1346
LOCK_global_system_variables.lock();
1347
1347
global_system_variables.*offset= microseconds;
1348
pthread_mutex_unlock(&LOCK_global_system_variables);
1348
LOCK_global_system_variables.unlock();
1351
1351
session->variables.*offset= microseconds;