Skip to content

Commit

Permalink
MDEV-15133 array bound (bulk) parameters of NULL propagate on next rows
Browse files Browse the repository at this point in the history
null_value was not properly reset when setting parameter value
  • Loading branch information
montywi committed Jan 30, 2018
1 parent 0c1f220 commit e300f0c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sql/item.cc
Expand Up @@ -3781,6 +3781,7 @@ void Item_param::set_int(longlong i, uint32 max_length_arg)
max_length= max_length_arg;
decimals= 0;
maybe_null= 0;
null_value= 0;
fix_type(Item::INT_ITEM);
DBUG_VOID_RETURN;
}
Expand All @@ -3795,6 +3796,7 @@ void Item_param::set_double(double d)
max_length= DBL_DIG + 8;
decimals= NOT_FIXED_DEC;
maybe_null= 0;
null_value= 0;
fix_type(Item::REAL_ITEM);
DBUG_VOID_RETURN;
}
Expand Down Expand Up @@ -3827,6 +3829,7 @@ void Item_param::set_decimal(const char *str, ulong length)
my_decimal_precision_to_length_no_truncation(value.m_decimal.precision(),
decimals, unsigned_flag);
maybe_null= 0;
null_value= 0;
fix_type(Item::DECIMAL_ITEM);
DBUG_VOID_RETURN;
}
Expand All @@ -3843,6 +3846,7 @@ void Item_param::set_decimal(const my_decimal *dv, bool unsigned_arg)
unsigned_flag= unsigned_arg;
max_length= my_decimal_precision_to_length(value.m_decimal.intg + decimals,
decimals, unsigned_flag);
null_value= 0;
fix_type(Item::DECIMAL_ITEM);
}

Expand All @@ -3862,6 +3866,7 @@ void Item_param::set_time(const MYSQL_TIME *tm,
{
DBUG_ASSERT(value.type_handler()->cmp_type() == TIME_RESULT);
value.time= *tm;
null_value= 0;
fix_temporal(max_length_arg, decimals_arg);
}

Expand Down Expand Up @@ -3896,6 +3901,7 @@ void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type,
set_zero_time(&value.time, MYSQL_TIMESTAMP_ERROR);
}
maybe_null= 0;
null_value= 0;
fix_temporal(max_length_arg,
tm->second_part > 0 ? TIME_SECOND_PART_DIGITS : 0);
DBUG_VOID_RETURN;
Expand Down Expand Up @@ -3932,6 +3938,7 @@ bool Item_param::set_str(const char *str, ulong length,
collation.set(tocs, DERIVATION_COERCIBLE);
max_length= length;
maybe_null= 0;
null_value= 0;
/* max_length and decimals are set after charset conversion */
/* sic: str may be not null-terminated, don't add DBUG_PRINT here */
fix_type(Item::STRING_ITEM);
Expand Down Expand Up @@ -3967,6 +3974,7 @@ bool Item_param::set_longdata(const char *str, ulong length)
DBUG_RETURN(TRUE);
state= LONG_DATA_VALUE;
maybe_null= 0;
null_value= 0;
fix_type(Item::STRING_ITEM);

DBUG_RETURN(FALSE);
Expand Down

0 comments on commit e300f0c

Please sign in to comment.