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

Method exec_inner

sql/sql_union.cc:2354–2599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2352
2353
2354bool st_select_lex_unit::exec_inner()
2355{
2356 SELECT_LEX *lex_select_save= thd->lex->current_select;
2357 SELECT_LEX *select_cursor=first_select();
2358 ulonglong add_rows=0;
2359 bool first_execution= !executed;
2360 bool was_executed= executed;
2361 int error;
2362
2363 executed= 1;
2364 if (!(uncacheable & ~UNCACHEABLE_EXPLAIN) && item &&
2365 !item->with_recursive_reference)
2366 item->make_const();
2367
2368 saved_error= optimize();
2369
2370 create_explain_query_if_not_exists(thd->lex, thd->mem_root);
2371
2372 if (!saved_error && !was_executed)
2373 save_union_explain(thd->lex->explain);
2374
2375 error= saved_error;
2376
2377 if (unlikely(error))
2378 {
2379 err:
2380 thd->lex->current_select= lex_select_save;
2381 return error;
2382 }
2383
2384 if (union_result)
2385 {
2386 union_result->init();
2387 if (uncacheable & UNCACHEABLE_DEPENDENT &&
2388 union_result->table && union_result->table->is_created())
2389 {
2390 union_result->table->file->ha_delete_all_rows();
2391 union_result->table->file->ha_enable_indexes(key_map(table->s->keys), false);
2392 }
2393 }
2394
2395 if (uncacheable || !item || !item->assigned() || describe)
2396 {
2397 if (!fake_select_lex && !(with_element && with_element->is_recursive))
2398 union_result->reset_for_next_ps_execution();
2399 for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
2400 {
2401 ha_rows records_at_start= 0;
2402 thd->lex->current_select= sl;
2403 if (union_result)
2404 union_result->change_select();
2405 if (fake_select_lex)
2406 {
2407 if (sl != thd->lex->first_select_lex())
2408 fake_select_lex->uncacheable|= sl->uncacheable;
2409 else
2410 fake_select_lex->uncacheable= 0;
2411 }

Callers

nothing calls this directly

Calls 15

dbug_serve_apcsFunction · 0.85
mysql_selectFunction · 0.85
ha_delete_all_rowsMethod · 0.80
ha_enable_indexesMethod · 0.80
assignedMethod · 0.80
next_selectMethod · 0.80
first_select_lexMethod · 0.80
remove_offsetMethod · 0.80
set_unlimitedMethod · 0.80
is_unlimitedMethod · 0.80
ha_disable_indexesMethod · 0.80

Tested by

no test coverage detected