Commit 28b54d14 authored by Evgeny Potemkin's avatar Evgeny Potemkin

Additional fix for the bug#43668.

Arg_comparator now takes into account that some of
optimizations aren't done in the PREPARE stmt.
parent 982bfdb0
...@@ -960,12 +960,23 @@ int Arg_comparator::set_cmp_func(Item_result_field *owner_arg, ...@@ -960,12 +960,23 @@ int Arg_comparator::set_cmp_func(Item_result_field *owner_arg,
(*b)->field_type() == MYSQL_TYPE_YEAR)) (*b)->field_type() == MYSQL_TYPE_YEAR))
{ {
is_nulls_eq= is_owner_equal_func(); is_nulls_eq= is_owner_equal_func();
year_as_datetime= FALSE;
if ((*a)->is_datetime()) if ((*a)->is_datetime())
{ {
year_as_datetime= TRUE; year_as_datetime= TRUE;
get_value_a_func= &get_datetime_value; get_value_a_func= &get_datetime_value;
} else if ((*a)->field_type() == MYSQL_TYPE_YEAR) } else if ((*a)->field_type() == MYSQL_TYPE_YEAR)
get_value_a_func= &get_year_value; get_value_a_func= &get_year_value;
else
{
/*
Because convert_constant_item is called only for EXECUTE in PS mode
the value of get_value_x_func set in PREPARE might be not
valid for EXECUTE.
*/
get_value_a_func= NULL;
}
if ((*b)->is_datetime()) if ((*b)->is_datetime())
{ {
...@@ -973,6 +984,8 @@ int Arg_comparator::set_cmp_func(Item_result_field *owner_arg, ...@@ -973,6 +984,8 @@ int Arg_comparator::set_cmp_func(Item_result_field *owner_arg,
get_value_b_func= &get_datetime_value; get_value_b_func= &get_datetime_value;
} else if ((*b)->field_type() == MYSQL_TYPE_YEAR) } else if ((*b)->field_type() == MYSQL_TYPE_YEAR)
get_value_b_func= &get_year_value; get_value_b_func= &get_year_value;
else
get_value_b_func= NULL;
func= &Arg_comparator::compare_year; func= &Arg_comparator::compare_year;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment