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

Function setup_windows

sql/sql_window.cc:202–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200*/
201
202int
203setup_windows(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables,
204 List<Item> &fields, List<Item> &all_fields,
205 List<Window_spec> &win_specs, List<Item_window_func> &win_funcs)
206{
207 Window_spec *win_spec;
208 DBUG_ENTER("setup_windows");
209 List_iterator<Window_spec> it(win_specs);
210
211 if (!thd->lex->current_select->is_win_spec_list_built)
212 {
213
214 /*
215 Move all unnamed specifications after the named ones.
216 We could have avoided it if we had built two separate lists for
217 named and unnamed specifications.
218 */
219 Query_arena *arena, backup;
220 arena= thd->activate_stmt_arena_if_needed(&backup);
221 uint i = 0;
222 uint elems= win_specs.elements;
223 while ((win_spec= it++) && i++ < elems)
224 {
225 if (win_spec->name().str == NULL)
226 {
227 it.remove();
228 win_specs.push_back(win_spec);
229 }
230 }
231 if (arena)
232 thd->restore_active_arena(arena, &backup);
233
234 it.rewind();
235
236 thd->lex->current_select->is_win_spec_list_built= true;
237 }
238
239 List_iterator_fast<Window_spec> itp(win_specs);
240
241 while ((win_spec= it++))
242 {
243 bool hidden_group_fields;
244 if (win_spec->check_window_names(itp) ||
245 setup_group(thd, ref_pointer_array, tables, fields, all_fields,
246 win_spec->partition_list->first, &hidden_group_fields,
247 true) ||
248 setup_order(thd, ref_pointer_array, tables, fields, all_fields,
249 win_spec->order_list->first, true) ||
250 (win_spec->window_frame &&
251 win_spec->window_frame->check_frame_bounds()))
252 {
253 DBUG_RETURN(1);
254 }
255
256 if (win_spec->window_frame &&
257 win_spec->window_frame->exclusion != Window_frame::EXCL_NONE)
258 {
259 my_error(ER_FRAME_EXCLUSION_NOT_SUPPORTED, MYF(0));

Callers 1

setup_without_groupFunction · 0.85

Calls 14

setup_groupFunction · 0.85
setup_orderFunction · 0.85
my_errorFunction · 0.85
restore_active_arenaMethod · 0.80
check_window_namesMethod · 0.80
check_frame_boundsMethod · 0.80
is_unboundedMethod · 0.80
nameMethod · 0.45
removeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected