109
109
static void fix_trans_mem_root(Session *session, enum_var_type type);
110
110
static void fix_server_id(Session *session, enum_var_type type);
111
111
static uint64_t fix_unsigned(Session *, uint64_t, const struct my_option *);
112
static bool get_unsigned(Session *session, set_var *var);
112
static bool get_unsigned32(Session *session, set_var *var);
113
static bool get_unsigned64(Session *session, set_var *var);
113
114
bool throw_bounds_warning(Session *session, bool fixed, bool unsignd,
114
115
const char *name, int64_t val);
115
116
static KEY_CACHE *create_key_cache(const char *name, uint32_t length);
183
184
&opt_local_infile);
184
185
static sys_var_session_uint32_t sys_max_allowed_packet(&vars, "max_allowed_packet",
185
186
&SV::max_allowed_packet);
186
static sys_var_long_ptr sys_max_connect_errors(&vars, "max_connect_errors",
187
static sys_var_uint64_t_ptr sys_max_connect_errors(&vars, "max_connect_errors",
187
188
&max_connect_errors);
188
189
static sys_var_session_uint64_t sys_max_error_count(&vars, "max_error_count",
189
190
&SV::max_error_count);
204
205
&SV::max_sort_length);
205
206
static sys_var_session_uint64_t sys_max_tmp_tables(&vars, "max_tmp_tables",
206
207
&SV::max_tmp_tables);
207
static sys_var_long_ptr sys_max_write_lock_count(&vars, "max_write_lock_count",
208
static sys_var_uint64_t_ptr sys_max_write_lock_count(&vars, "max_write_lock_count",
208
209
&max_write_lock_count);
209
210
static sys_var_session_uint64_t sys_min_examined_row_limit(&vars, "min_examined_row_limit",
210
211
&SV::min_examined_row_limit);
274
275
static sys_var_uint32_t_ptr sys_server_id(&vars, "server_id", &server_id,
277
static sys_var_long_ptr sys_slow_launch_time(&vars, "slow_launch_time",
278
static sys_var_uint64_t_ptr sys_slow_launch_time(&vars, "slow_launch_time",
278
279
&slow_launch_time);
279
280
static sys_var_session_size_t sys_sort_buffer(&vars, "sort_buffer_size",
280
281
&SV::sortbuff_size);
291
292
&SV::table_plugin);
292
293
static sys_var_const_str sys_system_time_zone(&vars, "system_time_zone",
293
294
system_time_zone);
294
static sys_var_long_ptr sys_table_def_size(&vars, "table_definition_cache",
295
static sys_var_uint64_t_ptr sys_table_def_size(&vars, "table_definition_cache",
295
296
&table_def_size);
296
static sys_var_long_ptr sys_table_cache_size(&vars, "table_open_cache",
297
static sys_var_uint64_t_ptr sys_table_cache_size(&vars, "table_open_cache",
297
298
&table_cache_size);
298
static sys_var_long_ptr sys_table_lock_wait_timeout(&vars, "table_lock_wait_timeout",
299
static sys_var_uint64_t_ptr sys_table_lock_wait_timeout(&vars, "table_lock_wait_timeout",
299
300
&table_lock_wait_timeout);
300
301
static sys_var_session_enum sys_tx_isolation(&vars, "tx_isolation",
301
302
&SV::tx_isolation,
642
push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
643
push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
643
644
ER_TRUNCATED_WRONG_VALUE,
644
645
ER(ER_TRUNCATED_WRONG_VALUE), name, buf);
670
static bool get_unsigned(Session *, set_var *var)
672
if (var->value->unsigned_flag)
673
var->save_result.uint64_t_value= (uint64_t) var->value->val_int();
676
int64_t v= var->value->val_int();
677
var->save_result.uint64_t_value= (uint64_t) ((v < 0) ? 0 : v);
671
static bool get_unsigned32(Session *, set_var *var)
673
if (var->value->unsigned_flag)
674
var->save_result.uint32_t_value= (uint32_t) var->value->val_int();
677
int64_t v= var->value->val_int();
678
var->save_result.uint32_t_value= (uint32_t) ((v < 0) ? 0 : v);
683
static bool get_unsigned64(Session *, set_var *var)
685
if (var->value->unsigned_flag)
686
var->save_result.uint64_t_value=(uint64_t) var->value->val_int();
689
int64_t v= var->value->val_int();
690
var->save_result.uint64_t_value= (uint64_t) ((v < 0) ? 0 : v);
696
sys_var_long_ptr(sys_var_chain *chain, const char *name_arg, uint64_t *value_ptr_arg,
697
sys_after_update_func after_update_arg)
698
:sys_var_long_ptr_global(chain, name_arg, value_ptr_arg,
699
&LOCK_global_system_variables, after_update_arg)
703
bool sys_var_long_ptr_global::check(Session *session, set_var *var)
705
return get_unsigned(session, var);
708
bool sys_var_long_ptr_global::update(Session *session, set_var *var)
710
uint64_t tmp= var->save_result.uint64_t_value;
711
pthread_mutex_lock(guard);
713
*value= (uint64_t) fix_unsigned(session, tmp, option_limits);
716
if (tmp > UINT32_MAX)
719
throw_bounds_warning(session, true, true, name,
720
(int64_t) var->save_result.uint64_t_value);
722
*value= (uint64_t) tmp;
725
pthread_mutex_unlock(guard);
707
bool sys_var_uint32_t_ptr::check(Session *, set_var *var)
709
var->save_result.uint32_t_value= var->value->val_int();
730
void sys_var_long_ptr_global::set_default(Session *, enum_var_type)
733
pthread_mutex_lock(guard);
734
*value= (uint64_t) getopt_ull_limit_value((uint64_t) option_limits->def_value,
735
option_limits, ¬_used);
736
pthread_mutex_unlock(guard);
739
713
bool sys_var_uint32_t_ptr::update(Session *session, set_var *var)
741
715
uint32_t tmp= var->save_result.uint32_t_value;
742
716
pthread_mutex_lock(&LOCK_global_system_variables);
743
717
if (option_limits)
744
*value= (uint32_t) fix_unsigned(session, tmp, option_limits);
719
uint32_t newvalue= (uint32_t) fix_unsigned(session, tmp, option_limits);
746
724
*value= (uint32_t) tmp;
747
725
pthread_mutex_unlock(&LOCK_global_system_variables);
764
742
uint64_t tmp= var->save_result.uint64_t_value;
765
743
pthread_mutex_lock(&LOCK_global_system_variables);
766
744
if (option_limits)
767
*value= (uint64_t) fix_unsigned(session, tmp, option_limits);
746
uint64_t newvalue= (uint64_t) fix_unsigned(session, tmp, option_limits);
769
751
*value= (uint64_t) tmp;
770
752
pthread_mutex_unlock(&LOCK_global_system_variables);
842
824
bool sys_var_session_uint32_t::check(Session *session, set_var *var)
844
return (get_unsigned(session, var) ||
826
return (get_unsigned32(session, var) ||
845
827
(check_func && (*check_func)(session, var)));
848
830
bool sys_var_session_uint32_t::update(Session *session, set_var *var)
850
uint64_t tmp= var->save_result.uint64_t_value;
832
uint64_t tmp= (uint64_t) var->save_result.uint32_t_value;
852
834
/* Don't use bigger value than given with --maximum-variable-name=.. */
853
835
if ((uint32_t) tmp > max_system_variables.*offset)
950
932
bool sys_var_session_uint64_t::check(Session *session, set_var *var)
952
return (get_unsigned(session, var) ||
934
return (get_unsigned64(session, var) ||
953
935
(check_func && (*check_func)(session, var)));