| 598 | */ |
| 599 | |
| 600 | int Explain_union::print_explain_regular(Explain_query *query, |
| 601 | select_result_sink *output, |
| 602 | uint8 explain_flags, |
| 603 | bool is_analyze) |
| 604 | { |
| 605 | THD *thd= output->thd; |
| 606 | MEM_ROOT *mem_root= thd->mem_root; |
| 607 | char table_name_buffer[SAFE_NAME_LEN]; |
| 608 | |
| 609 | /* print all UNION children, in order */ |
| 610 | for (int i= 0; i < (int) union_members.elements(); i++) |
| 611 | { |
| 612 | Explain_select *sel= query->get_select(union_members.at(i)); |
| 613 | sel->print_explain(query, output, explain_flags, is_analyze); |
| 614 | } |
| 615 | |
| 616 | if (!using_tmp) |
| 617 | { |
| 618 | /* |
| 619 | The union operation may not employ a temporary table, for example, |
| 620 | for UNION ALL, in that case the results of the query are sent directly |
| 621 | to the output. So there is no actual UNION operation and we don't need |
| 622 | to print the line in the EXPLAIN output. |
| 623 | */ |
| 624 | return 0; |
| 625 | } |
| 626 | |
| 627 | /* Print a line with "UNIT RESULT" */ |
| 628 | List<Item> item_list; |
| 629 | Item *item_null= new (mem_root) Item_null(thd); |
| 630 | |
| 631 | /* `id` column */ |
| 632 | item_list.push_back(item_null, mem_root); |
| 633 | |
| 634 | /* `select_type` column */ |
| 635 | push_str(thd, &item_list, fake_select_type); |
| 636 | |
| 637 | /* `table` column: something like "<union1,2>" */ |
| 638 | uint len= make_union_table_name(table_name_buffer); |
| 639 | item_list.push_back(new (mem_root) |
| 640 | Item_string_sys(thd, table_name_buffer, len), |
| 641 | mem_root); |
| 642 | |
| 643 | /* `partitions` column */ |
| 644 | if (explain_flags & DESCRIBE_PARTITIONS) |
| 645 | item_list.push_back(item_null, mem_root); |
| 646 | |
| 647 | /* `type` column */ |
| 648 | push_str(thd, &item_list, join_type_str[JT_ALL]); |
| 649 | |
| 650 | /* `possible_keys` column */ |
| 651 | item_list.push_back(item_null, mem_root); |
| 652 | |
| 653 | /* `key` */ |
| 654 | item_list.push_back(item_null, mem_root); |
| 655 | |
| 656 | /* `key_len` */ |
| 657 | item_list.push_back(item_null, mem_root); |
nothing calls this directly
no test coverage detected