MCPcopy Create free account
hub / github.com/MariaDB/server / cleanup

Method cleanup

sql/sql_union.cc:2733–2835  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2731
2732
2733bool st_select_lex_unit::cleanup()
2734{
2735 bool error= 0;
2736 DBUG_ENTER("st_select_lex_unit::cleanup");
2737
2738 if (cleaned)
2739 {
2740 DBUG_RETURN(FALSE);
2741 }
2742 if (with_element && with_element->is_recursive && union_result &&
2743 with_element->rec_outer_references)
2744 {
2745 select_union_recursive *result= with_element->rec_result;
2746 if (++result->cleanup_count == with_element->rec_outer_references)
2747 {
2748 /*
2749 Perform cleanup for with_element and for all with elements
2750 mutually recursive with it.
2751 */
2752 cleaned= 1;
2753 with_element->get_next_mutually_recursive()->spec->cleanup();
2754 }
2755 else
2756 {
2757 /*
2758 Just increment by 1 cleanup_count for with_element and
2759 for all with elements mutually recursive with it.
2760 */
2761 With_element *with_elem= with_element;
2762 while ((with_elem= with_elem->get_next_mutually_recursive()) !=
2763 with_element)
2764 if (with_elem->rec_result)
2765 with_elem->rec_result->cleanup_count++;
2766 DBUG_RETURN(FALSE);
2767 }
2768 }
2769 columns_are_renamed= false;
2770 cleaned= 1;
2771
2772 for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select())
2773 error|= sl->cleanup();
2774
2775 if (fake_select_lex)
2776 {
2777 error|= fake_select_lex->cleanup();
2778 /*
2779 There are two cases when we should clean order items:
2780 1. UNION with SELECTs which all enclosed into braces
2781 in this case global_parameters == fake_select_lex
2782 2. UNION where last SELECT is not enclosed into braces
2783 in this case global_parameters == 'last select'
2784 So we should use global_parameters->order_list for
2785 proper order list clean up.
2786 Note: global_parameters and fake_select_lex are always
2787 initialized for UNION
2788 */
2789 DBUG_ASSERT(global_parameters());
2790 if (global_parameters()->order_list.elements)

Callers 3

mysql_unionFunction · 0.45
prepareMethod · 0.45
cleanup_all_joinsMethod · 0.45

Calls 14

free_tmp_tableFunction · 0.85
cleanup_orderFunction · 0.85
cleanup_ftfuncsFunction · 0.85
cleanup_window_funcsFunction · 0.85
next_selectMethod · 0.80
mark_as_cleanedMethod · 0.80
next_unitMethod · 0.80
walkMethod · 0.45

Tested by

no test coverage detected