summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorTatiana A. Nurnberg <azundris@mysql.com>2009-03-05 16:42:12 +0100
committerTatiana A. Nurnberg <azundris@mysql.com>2009-03-05 16:42:12 +0100
commit13328b0f45c449020b3b70ed9de1668e16d51bb4 (patch)
treef08428162e2b12101d976fbed6b54c29a35f9de3 /sql
parentfe09326edf3f3319d9e998630fc684d618c87bcb (diff)
downloadmariadb-git-13328b0f45c449020b3b70ed9de1668e16d51bb4.tar.gz
Bug#40657: assertion with out of range variables and traditional sql_mode
Some changes that make things more elegant in 6.0, backported so the code is mostly the same in 5.1, for easier maintainence. sql/set_var.cc: Backporting some changes to 5.1 so the code is mostly the same in both versions. Less to learn!
Diffstat (limited to 'sql')
-rw-r--r--sql/set_var.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 4e93500a748..6c2ac2e32a9 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -1455,13 +1455,12 @@ static void bound_unsigned(THD *thd, ulonglong *num,
@param thd thread handle
@param var the system-variable to get
@param user_max a limit given with --maximum-variable-name=... or 0
- @param bound2ulong pass TRUE if size is ulong, not ulonglong. function
- will then bound on systems where it's necessary.
+ @param var_type function will bound on systems where necessary.
@retval TRUE on error, FALSE otherwise (warning or OK)
*/
static bool get_unsigned(THD *thd, set_var *var, ulonglong user_max,
- my_bool bound2ulong)
+ ulong var_type)
{
int warnings= 0;
ulonglong unadjusted;
@@ -1506,10 +1505,10 @@ static bool get_unsigned(THD *thd, set_var *var, ulonglong user_max,
the usual suspects handle the actual limiting.
*/
- if (!limits && bound2ulong)
+ if (!limits && var_type != GET_ULL)
{
bzero(&fallback, sizeof(fallback));
- fallback.var_type= GET_ULONG;
+ fallback.var_type= var_type;
limits= &fallback;
}
@@ -1541,7 +1540,7 @@ sys_var_long_ptr(sys_var_chain *chain, const char *name_arg, ulong *value_ptr_ar
bool sys_var_long_ptr_global::check(THD *thd, set_var *var)
{
- return get_unsigned(thd, var, 0, TRUE);
+ return get_unsigned(thd, var, 0, GET_ULONG);
}
bool sys_var_long_ptr_global::update(THD *thd, set_var *var)
@@ -1618,7 +1617,7 @@ uchar *sys_var_enum_const::value_ptr(THD *thd, enum_var_type type,
bool sys_var_thd_ulong::check(THD *thd, set_var *var)
{
- if (get_unsigned(thd, var, max_system_variables.*offset, TRUE))
+ if (get_unsigned(thd, var, max_system_variables.*offset, GET_ULONG))
return TRUE;
DBUG_ASSERT(var->save_result.ulonglong_value <= ULONG_MAX);
return ((check_func && (*check_func)(thd, var)));
@@ -1709,7 +1708,7 @@ uchar *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type,
bool sys_var_thd_ulonglong::check(THD *thd, set_var *var)
{
- return get_unsigned(thd, var, max_system_variables.*offset, FALSE);
+ return get_unsigned(thd, var, max_system_variables.*offset, GET_ULL);
}
bool sys_var_thd_ulonglong::update(THD *thd, set_var *var)
@@ -2384,7 +2383,7 @@ end:
*/
bool sys_var_key_cache_long::update(THD *thd, set_var *var)
{
- ulonglong tmp= (ulonglong) (ulong) var->value->val_int();
+ ulonglong tmp= var->value->val_int();
LEX_STRING *base_name= &var->base;
bool error= 0;