| 33868 | */ |
| 33869 | |
| 33870 | enum_nested_loop_state |
| 33871 | AGGR_OP::end_send() |
| 33872 | { |
| 33873 | enum_nested_loop_state rc= NESTED_LOOP_OK; |
| 33874 | TABLE *table= join_tab->table; |
| 33875 | JOIN *join= join_tab->join; |
| 33876 | |
| 33877 | // All records were stored, send them further |
| 33878 | int tmp, new_errno= 0; |
| 33879 | |
| 33880 | if ((rc= put_record(true)) < NESTED_LOOP_OK) |
| 33881 | return rc; |
| 33882 | |
| 33883 | if ((tmp= table->file->extra(HA_EXTRA_NO_CACHE))) |
| 33884 | { |
| 33885 | DBUG_PRINT("error",("extra(HA_EXTRA_NO_CACHE) failed")); |
| 33886 | new_errno= tmp; |
| 33887 | } |
| 33888 | if ((tmp= table->file->ha_index_or_rnd_end())) |
| 33889 | { |
| 33890 | DBUG_PRINT("error",("ha_index_or_rnd_end() failed")); |
| 33891 | new_errno= tmp; |
| 33892 | } |
| 33893 | if (new_errno) |
| 33894 | { |
| 33895 | table->file->print_error(new_errno,MYF(0)); |
| 33896 | return NESTED_LOOP_ERROR; |
| 33897 | } |
| 33898 | |
| 33899 | // Update ref array |
| 33900 | join_tab->join->set_items_ref_array(*join_tab->ref_array); |
| 33901 | bool keep_last_filesort_result = join_tab->filesort ? false : true; |
| 33902 | if (join_tab->window_funcs_step) |
| 33903 | { |
| 33904 | if (join_tab->window_funcs_step->exec(join, keep_last_filesort_result)) |
| 33905 | return NESTED_LOOP_ERROR; |
| 33906 | } |
| 33907 | |
| 33908 | table->reginfo.lock_type= TL_UNLOCK; |
| 33909 | |
| 33910 | bool in_first_read= true; |
| 33911 | |
| 33912 | /* |
| 33913 | Reset the counter before copying rows from internal temporary table to |
| 33914 | INSERT table. |
| 33915 | */ |
| 33916 | join_tab->join->thd->get_stmt_da()->reset_current_row_for_warning(1); |
| 33917 | while (rc == NESTED_LOOP_OK) |
| 33918 | { |
| 33919 | int error; |
| 33920 | if (in_first_read) |
| 33921 | { |
| 33922 | in_first_read= false; |
| 33923 | error= join_init_read_record(join_tab); |
| 33924 | } |
| 33925 | else |
| 33926 | error= join_tab->read_record.read_record(); |
| 33927 |
no test coverage detected