114
114
static void fix_max_join_size(Session *session, sql_var_t type);
115
115
static void fix_session_mem_root(Session *session, sql_var_t type);
116
116
static void fix_server_id(Session *session, sql_var_t type);
117
bool throw_bounds_warning(Session *session, bool fixed, bool unsignd,
118
const std::string &name, int64_t val);
117
void throw_bounds_warning(Session *session, bool fixed, bool unsignd, const std::string &name, int64_t val);
119
118
static unsigned char *get_error_count(Session *session);
120
119
static unsigned char *get_warning_count(Session *session);
121
120
static unsigned char *get_tmpdir(Session *session);
440
bool throw_bounds_warning(Session *session, bool fixed, bool unsignd,
441
const std::string &name, int64_t val)
439
void throw_bounds_warning(Session *session, bool fixed, bool unsignd, const std::string &name, int64_t val)
445
char buf[DECIMAL_LONGLONG_DIGITS];
448
internal::ullstr((uint64_t) val, buf);
450
internal::llstr(val, buf);
452
push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
453
ER_TRUNCATED_WRONG_VALUE,
454
ER(ER_TRUNCATED_WRONG_VALUE), name.c_str(), buf);
443
char buf[DECIMAL_LONGLONG_DIGITS];
446
internal::ullstr((uint64_t) val, buf);
448
internal::llstr(val, buf);
450
push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_ERROR,
451
ER_TRUNCATED_WRONG_VALUE, ER(ER_TRUNCATED_WRONG_VALUE), name.c_str(), buf);
459
uint64_t fix_unsigned(Session *session, uint64_t num,
460
const struct option *option_limits)
454
uint64_t fix_unsigned(Session *session, uint64_t num, const option& option_limits)
462
456
bool fixed= false;
463
457
uint64_t out= getopt_ull_limit_value(num, option_limits, &fixed);
465
throw_bounds_warning(session, fixed, true, option_limits->name, (int64_t) num);
459
throw_bounds_warning(session, fixed, true, option_limits.name, (int64_t) num);
470
static size_t fix_size_t(Session *session, size_t num,
471
const struct option *option_limits)
464
static size_t fix_size_t(Session *session, size_t num, const option& option_limits)
473
466
bool fixed= false;
474
467
size_t out= (size_t)getopt_ull_limit_value(num, option_limits, &fixed);
476
throw_bounds_warning(session, fixed, true, option_limits->name, (int64_t) num);
469
throw_bounds_warning(session, fixed, true, option_limits.name, (int64_t) num);
569
560
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
570
*value= (size_t)getopt_ull_limit_value((size_t) option_limits->def_value,
571
option_limits, ¬_used);
561
*value= (size_t)getopt_ull_limit_value((size_t) option_limits->def_value, *option_limits, ¬_used);
574
564
bool sys_var_bool_ptr::check(Session *session, set_var *var)
634
624
/* We will not come here if option_limits is not set */
635
625
global_system_variables.*offset=
636
(uint32_t) getopt_ull_limit_value((uint32_t) option_limits->def_value,
637
option_limits, ¬_used);
626
(uint32_t) getopt_ull_limit_value((uint32_t) option_limits->def_value, *option_limits, ¬_used);
640
629
session->variables.*offset= global_system_variables.*offset;
660
649
tmp= max_system_variables.*offset;
662
651
if (option_limits)
663
tmp= (ha_rows) fix_unsigned(session, tmp, option_limits);
652
tmp= (ha_rows) fix_unsigned(session, tmp, *option_limits);
664
653
if (var->type == OPT_GLOBAL)
666
655
/* Lock is needed to make things safe on 32 bit systems */
684
673
/* We will not come here if option_limits is not set */
685
674
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
686
675
global_system_variables.*offset=
687
(ha_rows) getopt_ull_limit_value((ha_rows) option_limits->def_value,
688
option_limits, ¬_used);
676
(ha_rows) getopt_ull_limit_value((ha_rows) option_limits->def_value, *option_limits, ¬_used);
744
732
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
745
733
global_system_variables.*offset=
746
getopt_ull_limit_value((uint64_t) option_limits->def_value,
747
option_limits, ¬_used);
734
getopt_ull_limit_value((uint64_t) option_limits->def_value, *option_limits, ¬_used);
776
763
tmp= max_system_variables.*offset;
778
765
if (option_limits)
779
tmp= fix_size_t(session, tmp, option_limits);
766
tmp= fix_size_t(session, tmp, *option_limits);
780
767
if (var->type == OPT_GLOBAL)
782
769
/* Lock is needed to make things safe on 32 bit systems */
800
787
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
801
788
global_system_variables.*offset=
802
(size_t)getopt_ull_limit_value((size_t) option_limits->def_value,
803
option_limits, ¬_used);
789
(size_t)getopt_ull_limit_value((size_t) option_limits->def_value, *option_limits, ¬_used);