474
474
bool sys_var_uint32_t_ptr::update(Session *session, set_var *var)
476
476
uint64_t tmp= var->getInteger();
477
LOCK_global_system_variables.lock();
477
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
478
479
if (option_limits)
480
481
uint32_t newvalue= (uint32_t) fix_unsigned(session, tmp, option_limits);
482
483
*value= newvalue;
485
487
*value= static_cast<uint32_t>(tmp);
486
LOCK_global_system_variables.unlock();
491
void sys_var_uint32_t_ptr::set_default(Session *, sql_var_t)
494
void sys_var_uint32_t_ptr::set_default(Session *session, sql_var_t)
494
LOCK_global_system_variables.lock();
497
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
495
498
*value= (uint32_t)getopt_ull_limit_value((uint32_t) option_limits->def_value,
496
499
option_limits, ¬_used);
497
LOCK_global_system_variables.unlock();
501
503
bool sys_var_uint64_t_ptr::update(Session *session, set_var *var)
503
505
uint64_t tmp= var->getInteger();
504
LOCK_global_system_variables.lock();
506
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
505
508
if (option_limits)
507
510
uint64_t newvalue= fix_unsigned(session, tmp, option_limits);
527
LOCK_global_system_variables.lock();
532
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
528
533
*value= getopt_ull_limit_value((uint64_t) option_limits->def_value,
529
534
option_limits, ¬_used);
530
LOCK_global_system_variables.unlock();
535
539
bool sys_var_size_t_ptr::update(Session *session, set_var *var)
537
541
size_t tmp= size_t(var->getInteger());
538
LOCK_global_system_variables.lock();
543
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
539
545
if (option_limits)
540
546
*value= fix_size_t(session, tmp, option_limits);
543
LOCK_global_system_variables.unlock();
548
void sys_var_size_t_ptr::set_default(Session *, sql_var_t)
554
void sys_var_size_t_ptr::set_default(Session *session, sql_var_t)
551
LOCK_global_system_variables.lock();
557
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
552
558
*value= (size_t)getopt_ull_limit_value((size_t) option_limits->def_value,
553
559
option_limits, ¬_used);
554
LOCK_global_system_variables.unlock();
557
562
bool sys_var_bool_ptr::update(Session *, set_var *var)
642
647
if (var->type == OPT_GLOBAL)
644
649
/* Lock is needed to make things safe on 32 bit systems */
645
LOCK_global_system_variables.lock();
650
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
646
651
global_system_variables.*offset= (ha_rows) tmp;
647
LOCK_global_system_variables.unlock();
650
655
session->variables.*offset= (ha_rows) tmp;
660
667
/* We will not come here if option_limits is not set */
661
LOCK_global_system_variables.lock();
668
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
662
669
global_system_variables.*offset=
663
670
(ha_rows) getopt_ull_limit_value((ha_rows) option_limits->def_value,
664
671
option_limits, ¬_used);
665
LOCK_global_system_variables.unlock();
668
675
session->variables.*offset= global_system_variables.*offset;
699
707
if (var->type == OPT_GLOBAL)
701
709
/* Lock is needed to make things safe on 32 bit systems */
702
LOCK_global_system_variables.lock();
710
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
703
711
global_system_variables.*offset= (uint64_t) tmp;
704
LOCK_global_system_variables.unlock();
707
715
session->variables.*offset= (uint64_t) tmp;
714
724
if (type == OPT_GLOBAL)
717
LOCK_global_system_variables.lock();
727
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
718
728
global_system_variables.*offset=
719
729
getopt_ull_limit_value((uint64_t) option_limits->def_value,
720
730
option_limits, ¬_used);
721
LOCK_global_system_variables.unlock();
724
734
session->variables.*offset= global_system_variables.*offset;
752
763
if (var->type == OPT_GLOBAL)
754
765
/* Lock is needed to make things safe on 32 bit systems */
755
LOCK_global_system_variables.lock();
766
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
756
767
global_system_variables.*offset= tmp;
757
LOCK_global_system_variables.unlock();
760
771
session->variables.*offset= tmp;
767
780
if (type == OPT_GLOBAL)
770
LOCK_global_system_variables.lock();
783
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
771
784
global_system_variables.*offset=
772
785
(size_t)getopt_ull_limit_value((size_t) option_limits->def_value,
773
786
option_limits, ¬_used);
774
LOCK_global_system_variables.unlock();
777
790
session->variables.*offset= global_system_variables.*offset;
889
LOCK_global_system_variables.lock();
904
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
890
905
value= *(uint*) value_ptr(session, var_type, base);
891
LOCK_global_system_variables.unlock();
892
907
return new Item_uint((uint64_t) value);
894
909
case SHOW_LONGLONG:
897
LOCK_global_system_variables.lock();
912
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
898
913
value= *(int64_t*) value_ptr(session, var_type, base);
899
LOCK_global_system_variables.unlock();
900
915
return new Item_int(value);
902
917
case SHOW_DOUBLE:
905
LOCK_global_system_variables.lock();
906
value= *(double*) value_ptr(session, var_type, base);
907
LOCK_global_system_variables.unlock();
921
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
922
value= *(double*) value_ptr(session, var_type, base);
908
925
/* 6, as this is for now only used with microseconds */
909
926
return new Item_float(value, 6);
911
928
case SHOW_HA_ROWS:
914
LOCK_global_system_variables.lock();
931
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
915
932
value= *(ha_rows*) value_ptr(session, var_type, base);
916
LOCK_global_system_variables.unlock();
917
934
return new Item_int((uint64_t) value);
922
LOCK_global_system_variables.lock();
939
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
923
940
value= *(size_t*) value_ptr(session, var_type, base);
924
LOCK_global_system_variables.unlock();
925
942
return new Item_int((uint64_t) value);
927
944
case SHOW_MY_BOOL:
930
LOCK_global_system_variables.lock();
947
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
931
948
value= *(bool*) value_ptr(session, var_type, base);
932
LOCK_global_system_variables.unlock();
933
949
return new Item_int(value,1);
935
951
case SHOW_CHAR_PTR:
938
LOCK_global_system_variables.lock();
954
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
939
955
char *str= *(char**) value_ptr(session, var_type, base);
948
964
tmp= new Item_null();
949
965
tmp->collation.set(system_charset_info, DERIVATION_SYSCONST);
951
LOCK_global_system_variables.unlock();
957
LOCK_global_system_variables.lock();
973
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
958
974
char *str= (char*) value_ptr(session, var_type, base);
960
976
tmp= new Item_string(str, strlen(str),
1150
1166
/* We are using Time_zone object found during check() phase. */
1151
1167
if (var->type == OPT_GLOBAL)
1153
LOCK_global_system_variables.lock();
1169
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
1154
1170
global_system_variables.time_zone= tmp;
1155
LOCK_global_system_variables.unlock();
1158
1174
session->variables.time_zone= tmp;
1188
1206
void sys_var_session_time_zone::set_default(Session *session, sql_var_t type)
1190
LOCK_global_system_variables.lock();
1191
if (type == OPT_GLOBAL)
1193
if (default_tz_name)
1195
String str(default_tz_name, &my_charset_utf8_general_ci);
1197
We are guaranteed to find this time zone since its existence
1198
is checked during start-up.
1200
global_system_variables.time_zone= my_tz_find(session, &str);
1203
global_system_variables.time_zone= my_tz_SYSTEM;
1206
session->variables.time_zone= global_system_variables.time_zone;
1207
LOCK_global_system_variables.unlock();
1208
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
1209
if (type == OPT_GLOBAL)
1211
if (default_tz_name)
1213
String str(default_tz_name, &my_charset_utf8_general_ci);
1215
We are guaranteed to find this time zone since its existence
1216
is checked during start-up.
1218
global_system_variables.time_zone= my_tz_find(session, &str);
1221
global_system_variables.time_zone= my_tz_SYSTEM;
1224
session->variables.time_zone= global_system_variables.time_zone;
1287
1304
microseconds= (int64_t) (num * 1000000.0 + 0.5);
1288
1305
if (var->type == OPT_GLOBAL)
1290
LOCK_global_system_variables.lock();
1307
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
1291
1308
(global_system_variables.*offset)= microseconds;
1292
LOCK_global_system_variables.unlock();
1295
1311
session->variables.*offset= microseconds;
1302
1318
int64_t microseconds= (int64_t) (option_limits->def_value * 1000000.0);
1303
1319
if (type == OPT_GLOBAL)
1305
LOCK_global_system_variables.lock();
1321
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
1306
1322
global_system_variables.*offset= microseconds;
1307
LOCK_global_system_variables.unlock();
1310
1325
session->variables.*offset= microseconds;