summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-06-15 17:22:49 +0200
committerSergei Golubchik <sergii@pisem.net>2012-06-15 17:22:49 +0200
commita247b12fe6d3356a2f9b115e3cd850bd004b4bd3 (patch)
treefa87c73e95f80e2538be2b7f9a1249d2c9a0fc5d /sql
parent37f5632212fd5cf6aafa272d33ca34da2320d570 (diff)
downloadmariadb-git-a247b12fe6d3356a2f9b115e3cd850bd004b4bd3.tar.gz
MDEV-316 lp:1009085 Assertion failed: warn_item, file item_cmpfunc.cc, line 3613
make sure that find_date_time_item() is called before agg_arg_charsets_for_comparison(). optimize Item_func_conv_charset to avoid conversion if no string result is needed
Diffstat (limited to 'sql')
-rw-r--r--sql/item_cmpfunc.cc19
-rw-r--r--sql/item_strfunc.h8
2 files changed, 18 insertions, 9 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 5f1a863d8fd..e38fe057356 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -3032,6 +3032,11 @@ void Item_func_case::fix_length_and_dec()
nagg++;
if (!(found_types= collect_cmp_types(agg, nagg)))
return;
+
+ Item *date_arg= 0;
+ if (found_types & (1 << TIME_RESULT))
+ date_arg= find_date_time_item(args, arg_count, 0);
+
if (found_types & (1 << STRING_RESULT))
{
/*
@@ -3071,16 +3076,12 @@ void Item_func_case::fix_length_and_dec()
change_item_tree_if_needed(thd, &args[nagg * 2], agg[nagg + 1]);
}
- Item *date_arg= 0;
for (i= 0; i <= (uint)TIME_RESULT; i++)
{
if (found_types & (1 << i) && !cmp_items[i])
{
DBUG_ASSERT((Item_result)i != ROW_RESULT);
- if ((Item_result)i == TIME_RESULT)
- date_arg= find_date_time_item(args, arg_count, 0);
-
if (!(cmp_items[i]=
cmp_item::get_comparator((Item_result)i, date_arg,
cmp_collation.collation)))
@@ -4051,15 +4052,15 @@ void Item_func_in::fix_length_and_dec()
}
else
{
+ if (found_types & (1 << TIME_RESULT))
+ date_arg= find_date_time_item(args, arg_count, 0);
+ if (found_types & (1 << STRING_RESULT) &&
+ agg_arg_charsets_for_comparison(cmp_collation, args, arg_count))
+ return;
for (i= 0; i <= (uint) TIME_RESULT; i++)
{
if (found_types & (1 << i) && !cmp_items[i])
{
- if ((Item_result)i == STRING_RESULT &&
- agg_arg_charsets_for_comparison(cmp_collation, args, arg_count))
- return;
- if ((Item_result)i == TIME_RESULT)
- date_arg= find_date_time_item(args, arg_count, 0);
if (!cmp_items[i] && !(cmp_items[i]=
cmp_item::get_comparator((Item_result)i, date_arg,
cmp_collation.collation)))
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index ad854b02765..3361464814e 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -854,6 +854,14 @@ public:
}
}
String *val_str(String *);
+ longlong val_int()
+ { return args[0]->val_int(); }
+ double val_real()
+ { return args[0]->val_real(); }
+ my_decimal *val_decimal(my_decimal *d)
+ { return args[0]->val_decimal(d); }
+ bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
+ { return args[0]->get_date(ltime, fuzzydate); }
void fix_length_and_dec();
const char *func_name() const { return "convert"; }
virtual void print(String *str, enum_query_type query_type);