| 4924 | |
| 4925 | |
| 4926 | int JOIN::exec_inner() |
| 4927 | { |
| 4928 | List<Item> *columns_list= &fields_list; |
| 4929 | DBUG_ENTER("JOIN::exec_inner"); |
| 4930 | DBUG_ASSERT(optimization_state == JOIN::OPTIMIZATION_DONE); |
| 4931 | |
| 4932 | THD_STAGE_INFO(thd, stage_executing); |
| 4933 | |
| 4934 | /* |
| 4935 | Activate enforcement of LIMIT ROWS EXAMINED during query execution if: |
| 4936 | (1) This JOIN is the outermost query (not a subquery or derived table) |
| 4937 | This ensures that the limit is enabled when actual execution begins, |
| 4938 | and not if a subquery is evaluated during optimization of the outer |
| 4939 | query. |
| 4940 | (2) This JOIN is not the result of a UNION. In this case do not apply the |
| 4941 | limit in order to produce the partial query result stored in the |
| 4942 | UNION temp table. |
| 4943 | */ |
| 4944 | |
| 4945 | if (!select_lex->outer_select() && // (1) |
| 4946 | select_lex != select_lex->master_unit()->fake_select_lex) // (2) |
| 4947 | thd->lex->set_limit_rows_examined(); |
| 4948 | |
| 4949 | if (procedure) |
| 4950 | { |
| 4951 | procedure_fields_list= fields_list; |
| 4952 | if (procedure->change_columns(thd, procedure_fields_list) || |
| 4953 | result->prepare(procedure_fields_list, unit)) |
| 4954 | { |
| 4955 | thd->limit_found_rows= 0; |
| 4956 | DBUG_RETURN(0); |
| 4957 | } |
| 4958 | columns_list= &procedure_fields_list; |
| 4959 | } |
| 4960 | if (result->prepare2(this)) |
| 4961 | DBUG_RETURN(error); |
| 4962 | |
| 4963 | if (!tables_list && (table_count || !select_lex->with_sum_func) && |
| 4964 | !select_lex->have_window_funcs()) |
| 4965 | { // Only test of functions |
| 4966 | if (select_options & SELECT_DESCRIBE) |
| 4967 | select_describe(this, FALSE, FALSE, FALSE, |
| 4968 | (zero_result_cause?zero_result_cause:"No tables used")); |
| 4969 | else |
| 4970 | { |
| 4971 | if (result->send_result_set_metadata(*columns_list, |
| 4972 | Protocol::SEND_NUM_ROWS | |
| 4973 | Protocol::SEND_EOF)) |
| 4974 | { |
| 4975 | DBUG_RETURN(error); |
| 4976 | } |
| 4977 | |
| 4978 | /* |
| 4979 | We have to test for 'conds' here as the WHERE may not be constant |
| 4980 | even if we don't have any tables for prepared statements or if |
| 4981 | conds uses something like 'rand()'. |
| 4982 | If the HAVING clause is either impossible or always true, then |
| 4983 | JOIN::having is set to NULL by optimize_cond. |
nothing calls this directly
no test coverage detected