Commit bf1ca14f authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: Item_func_case

reorder items in args[] array. Instead of

  when1,then1,when2,then2,...[,case][,else]

sort them as

  [case,]when1,when2,...,then1,then2,...[,else]

in this case all items used for comparison take a continuous part
of the array and can be aggregated directly. and all items that
can be returned take a continuous part of the array and can be
aggregated directly. Old code had to copy them to a temporary
array before aggreation, and then copy back (thd->change_item_tree)
everything that was changed.
parent c14733f6
This diff is collapsed.
......@@ -1558,12 +1558,11 @@ class Item_func_case :public Item_func_hybrid_field_type
int first_expr_num, else_expr_num;
enum Item_result left_cmp_type;
String tmp_value;
uint ncases;
uint nwhens;
Item_result cmp_type;
DTCollation cmp_collation;
cmp_item *cmp_items[6]; /* For all result types */
cmp_item *case_item;
Item **arg_buffer;
uint m_found_types;
public:
Item_func_case(THD *thd, List<Item> &list, Item *first_expr_arg,
......@@ -1593,7 +1592,6 @@ class Item_func_case :public Item_func_hybrid_field_type
if (clone)
{
clone->case_item= 0;
clone->arg_buffer= 0;
bzero(&clone->cmp_items, sizeof(cmp_items));
}
return clone;
......
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