summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorEvgeny Potemkin <epotemkin@mysql.com>2009-11-25 12:52:03 +0300
committerEvgeny Potemkin <epotemkin@mysql.com>2009-11-25 12:52:03 +0300
commit0039944e0c739940a7228e916058f57b0e39b5db (patch)
tree4d99b0168a6928c28d56a36d03a4b77102fec6d7 /sql/item_cmpfunc.cc
parent8af680218ef330e58277ada13220d85218c6c48b (diff)
downloadmariadb-git-0039944e0c739940a7228e916058f57b0e39b5db.tar.gz
Additional fix for the bug#43668.
Arg_comparator now takes into account that some of optimizations aren't done in the PREPARE stmt.
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r--sql/item_cmpfunc.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 9662c0209c8..fd5eca8911a 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -960,12 +960,23 @@ int Arg_comparator::set_cmp_func(Item_result_field *owner_arg,
(*b)->field_type() == MYSQL_TYPE_YEAR))
{
is_nulls_eq= is_owner_equal_func();
+ year_as_datetime= FALSE;
+
if ((*a)->is_datetime())
{
year_as_datetime= TRUE;
get_value_a_func= &get_datetime_value;
} else if ((*a)->field_type() == MYSQL_TYPE_YEAR)
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())
{
@@ -973,6 +984,8 @@ int Arg_comparator::set_cmp_func(Item_result_field *owner_arg,
get_value_b_func= &get_datetime_value;
} else if ((*b)->field_type() == MYSQL_TYPE_YEAR)
get_value_b_func= &get_year_value;
+ else
+ get_value_b_func= NULL;
func= &Arg_comparator::compare_year;
return 0;