From ecd4bf62d439b300facb4d5758c4670e6c96b7c5 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 14 Mar 2013 19:07:20 +0200 Subject: MDEV-4272 fix. Incorrect NULL value handling in Item_func_conv_charset fixed. --- sql/item_strfunc.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'sql/item_strfunc.h') diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 786f66e3aab..3f2de5fd6f1 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -859,25 +859,37 @@ public: { if (args[0]->result_type() == STRING_RESULT) return Item_str_func::val_int(); - return args[0]->val_int(); + longlong res= args[0]->val_int(); + if ((null_value= args[0]->null_value)) + return 0; + return res; } double val_real() { if (args[0]->result_type() == STRING_RESULT) return Item_str_func::val_real(); - return args[0]->val_real(); + double res= args[0]->val_real(); + if ((null_value= args[0]->null_value)) + return 0; + return res; } my_decimal *val_decimal(my_decimal *d) { if (args[0]->result_type() == STRING_RESULT) return Item_str_func::val_decimal(d); - return args[0]->val_decimal(d); + my_decimal *res= args[0]->val_decimal(d); + if ((null_value= args[0]->null_value)) + return NULL; + return res; } bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) { if (args[0]->result_type() == STRING_RESULT) return Item_str_func::get_date(ltime, fuzzydate); - return args[0]->get_date(ltime, fuzzydate); + bool res= args[0]->get_date(ltime, fuzzydate); + if ((null_value= args[0]->null_value)) + return 1; + return res; } void fix_length_and_dec(); const char *func_name() const { return "convert"; } -- cgit v1.2.1 From a4a18e0cbbaf2a43507b3c2232fed700403ad04d Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 18 Mar 2013 10:35:03 +0100 Subject: MDEV-4289 Assertion `0' fails in make_sortkey with GROUP_CONCAT, MAKE_SET, GROUP BY Item_func_make_set wasn't taking into account the first argument when calculating maybe_null. sql/item_strfunc.cc: rewrite Item_func_make_set, removing separate storage of the first argument sql/item_strfunc.h: rewrite Item_func_make_set, removing separate storage of the first argument --- sql/item_strfunc.h | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'sql/item_strfunc.h') diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index e8fa041af4f..a4fae7c69a1 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -497,31 +497,13 @@ public: class Item_func_make_set :public Item_str_func { - Item *item; String tmp_str; public: - Item_func_make_set(Item *a,List &list) :Item_str_func(list),item(a) {} + Item_func_make_set(List &list) :Item_str_func(list) {} String *val_str(String *str); - bool fix_fields(THD *thd, Item **ref) - { - DBUG_ASSERT(fixed == 0); - return ((!item->fixed && item->fix_fields(thd, &item)) || - item->check_cols(1) || - Item_func::fix_fields(thd, ref)); - } - void split_sum_func(THD *thd, Item **ref_pointer_array, List &fields); void fix_length_and_dec(); - void update_used_tables(); const char *func_name() const { return "make_set"; } - - bool walk(Item_processor processor, bool walk_subquery, uchar *arg) - { - return item->walk(processor, walk_subquery, arg) || - Item_str_func::walk(processor, walk_subquery, arg); - } - Item *transform(Item_transformer transformer, uchar *arg); - virtual void print(String *str, enum_query_type query_type); }; -- cgit v1.2.1