| 614 | */ |
| 615 | |
| 616 | bool handle_select(THD *thd, LEX *lex, select_result *result, |
| 617 | ulonglong setup_tables_done_option) |
| 618 | { |
| 619 | bool res; |
| 620 | SELECT_LEX *select_lex= lex->first_select_lex(); |
| 621 | DBUG_ENTER("handle_select"); |
| 622 | MYSQL_SELECT_START(thd->query()); |
| 623 | |
| 624 | if (select_lex->master_unit()->is_unit_op() || |
| 625 | select_lex->master_unit()->fake_select_lex) |
| 626 | res= mysql_union(thd, lex, result, &lex->unit, setup_tables_done_option); |
| 627 | else |
| 628 | { |
| 629 | SELECT_LEX_UNIT *unit= &lex->unit; |
| 630 | unit->set_limit(unit->global_parameters()); |
| 631 | /* |
| 632 | 'options' of mysql_select will be set in JOIN, as far as JOIN for |
| 633 | every PS/SP execution new, we will not need reset this flag if |
| 634 | setup_tables_done_option changed for next reexecution |
| 635 | */ |
| 636 | res= mysql_select(thd, |
| 637 | select_lex->table_list.first, |
| 638 | select_lex->item_list, |
| 639 | select_lex->where, |
| 640 | select_lex->order_list.elements + |
| 641 | select_lex->group_list.elements, |
| 642 | select_lex->order_list.first, |
| 643 | select_lex->group_list.first, |
| 644 | select_lex->having, |
| 645 | lex->proc_list.first, |
| 646 | select_lex->options | thd->variables.option_bits | |
| 647 | setup_tables_done_option, |
| 648 | result, unit, select_lex); |
| 649 | } |
| 650 | DBUG_PRINT("info",("res: %d is_error(): %d", res, |
| 651 | thd->is_error())); |
| 652 | res|= thd->is_error(); |
| 653 | if (unlikely(res)) |
| 654 | result->abort_result_set(); |
| 655 | if (unlikely(thd->killed == ABORT_QUERY && !thd->no_errors)) |
| 656 | { |
| 657 | /* |
| 658 | If LIMIT ROWS EXAMINED interrupted query execution |
| 659 | continue with normal processing and produce an incomplete query |
| 660 | result. |
| 661 | A warning was generated by killed_for_exceeding_limit_rows(). |
| 662 | */ |
| 663 | thd->reset_killed(); |
| 664 | } |
| 665 | /* Deactivate LIMIT ROWS EXAMINED after query execution. */ |
| 666 | thd->lex->deactivate_limit_rows_examined(); |
| 667 | thd->killed_for_exceeding_limit_rows_warning_given= 0; |
| 668 | |
| 669 | MYSQL_SELECT_DONE((int) res, (ulong) thd->limit_found_rows); |
| 670 | DBUG_RETURN(res); |
| 671 | } |
| 672 | |
| 673 |
no test coverage detected