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

Method init

sql/item_subselect.cc:79–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77
78
79void Item_subselect::init(st_select_lex *select_lex,
80 select_result_interceptor *result)
81{
82 /*
83 Please see Item_singlerow_subselect::invalidate_and_restore_select_lex(),
84 which depends on alterations to the parse tree implemented here.
85 */
86
87 DBUG_ENTER("Item_subselect::init");
88 DBUG_PRINT("enter", ("select_lex: %p this: %p",
89 select_lex, this));
90
91 select_lex->parent_lex->relink_hack(select_lex);
92
93 unit= select_lex->master_unit();
94
95 if (unit->item)
96 {
97 engine= unit->item->engine;
98 parsing_place= unit->item->parsing_place;
99 if (unit->item->substype() == EXISTS_SUBS &&
100 ((Item_exists_subselect *)unit->item)->exists_transformed)
101 {
102 /* it is permanent transformation of EXISTS to IN */
103 unit->item= this;
104 engine->change_result(this, result, FALSE);
105 }
106 else
107 {
108 /*
109 Item can be changed in JOIN::prepare while engine in JOIN::optimize
110 => we do not copy old_engine here
111 */
112 unit->thd->change_item_tree((Item**)&unit->item, this);
113 engine->change_result(this, result, TRUE);
114 }
115 }
116 else
117 {
118 SELECT_LEX *outer_select= unit->outer_select();
119 THD *thd= unit->thd;
120 /*
121 do not take into account expression inside aggregate functions because
122 they can access original table fields
123 */
124 parsing_place= (outer_select->in_sum_expr ?
125 NO_MATTER :
126 outer_select->parsing_place);
127 if (unit->is_unit_op() &&
128 (unit->first_select()->next_select() || unit->fake_select_lex))
129 engine= new (thd->mem_root)
130 subselect_union_engine(unit, result, this);
131 else
132 engine= new (thd->mem_root)
133 subselect_single_select_engine(select_lex, result, this);
134 }
135 DBUG_PRINT("info", ("engine: %p", engine));
136 DBUG_VOID_RETURN;

Callers 2

setup_mat_engineMethod · 0.45
execMethod · 0.45

Calls 15

my_bitmap_init_memrootFunction · 0.85
my_snprintfFunction · 0.85
free_tmp_tableFunction · 0.85
bitmap_bits_setFunction · 0.85
bitmap_is_setFunction · 0.85
my_mallocFunction · 0.85
my_qsortFunction · 0.85
relink_hackMethod · 0.80
master_unitMethod · 0.80
change_item_treeMethod · 0.80
is_unit_opMethod · 0.80
next_selectMethod · 0.80

Tested by

no test coverage detected