Skip to content

Commit e300f0c

Browse files
committed
MDEV-15133 array bound (bulk) parameters of NULL propagate on next rows
null_value was not properly reset when setting parameter value
1 parent 0c1f220 commit e300f0c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sql/item.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3781,6 +3781,7 @@ void Item_param::set_int(longlong i, uint32 max_length_arg)
37813781
max_length= max_length_arg;
37823782
decimals= 0;
37833783
maybe_null= 0;
3784+
null_value= 0;
37843785
fix_type(Item::INT_ITEM);
37853786
DBUG_VOID_RETURN;
37863787
}
@@ -3795,6 +3796,7 @@ void Item_param::set_double(double d)
37953796
max_length= DBL_DIG + 8;
37963797
decimals= NOT_FIXED_DEC;
37973798
maybe_null= 0;
3799+
null_value= 0;
37983800
fix_type(Item::REAL_ITEM);
37993801
DBUG_VOID_RETURN;
38003802
}
@@ -3827,6 +3829,7 @@ void Item_param::set_decimal(const char *str, ulong length)
38273829
my_decimal_precision_to_length_no_truncation(value.m_decimal.precision(),
38283830
decimals, unsigned_flag);
38293831
maybe_null= 0;
3832+
null_value= 0;
38303833
fix_type(Item::DECIMAL_ITEM);
38313834
DBUG_VOID_RETURN;
38323835
}
@@ -3843,6 +3846,7 @@ void Item_param::set_decimal(const my_decimal *dv, bool unsigned_arg)
38433846
unsigned_flag= unsigned_arg;
38443847
max_length= my_decimal_precision_to_length(value.m_decimal.intg + decimals,
38453848
decimals, unsigned_flag);
3849+
null_value= 0;
38463850
fix_type(Item::DECIMAL_ITEM);
38473851
}
38483852

@@ -3862,6 +3866,7 @@ void Item_param::set_time(const MYSQL_TIME *tm,
38623866
{
38633867
DBUG_ASSERT(value.type_handler()->cmp_type() == TIME_RESULT);
38643868
value.time= *tm;
3869+
null_value= 0;
38653870
fix_temporal(max_length_arg, decimals_arg);
38663871
}
38673872

@@ -3896,6 +3901,7 @@ void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type,
38963901
set_zero_time(&value.time, MYSQL_TIMESTAMP_ERROR);
38973902
}
38983903
maybe_null= 0;
3904+
null_value= 0;
38993905
fix_temporal(max_length_arg,
39003906
tm->second_part > 0 ? TIME_SECOND_PART_DIGITS : 0);
39013907
DBUG_VOID_RETURN;
@@ -3932,6 +3938,7 @@ bool Item_param::set_str(const char *str, ulong length,
39323938
collation.set(tocs, DERIVATION_COERCIBLE);
39333939
max_length= length;
39343940
maybe_null= 0;
3941+
null_value= 0;
39353942
/* max_length and decimals are set after charset conversion */
39363943
/* sic: str may be not null-terminated, don't add DBUG_PRINT here */
39373944
fix_type(Item::STRING_ITEM);
@@ -3967,6 +3974,7 @@ bool Item_param::set_longdata(const char *str, ulong length)
39673974
DBUG_RETURN(TRUE);
39683975
state= LONG_DATA_VALUE;
39693976
maybe_null= 0;
3977+
null_value= 0;
39703978
fix_type(Item::STRING_ITEM);
39713979

39723980
DBUG_RETURN(FALSE);

0 commit comments

Comments
 (0)