ARGSUSED */
| 26336 | |
| 26337 | /* ARGSUSED */ |
| 26338 | static enum_nested_loop_state |
| 26339 | end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), |
| 26340 | bool end_of_records) |
| 26341 | { |
| 26342 | TABLE *const table= join_tab->table; |
| 26343 | DBUG_ENTER("end_write"); |
| 26344 | |
| 26345 | if (!end_of_records) |
| 26346 | { |
| 26347 | copy_fields(join_tab->tmp_table_param); |
| 26348 | if (copy_funcs(join_tab->tmp_table_param->items_to_copy, join->thd)) |
| 26349 | DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */ |
| 26350 | |
| 26351 | if (likely(!join_tab->having || join_tab->having->val_bool())) |
| 26352 | { |
| 26353 | int error; |
| 26354 | join->found_records++; |
| 26355 | join->accepted_rows++; |
| 26356 | if ((error= table->file->ha_write_tmp_row(table->record[0]))) |
| 26357 | { |
| 26358 | if (likely(!table->file->is_fatal_error(error, HA_CHECK_DUP))) |
| 26359 | goto end; // Ignore duplicate keys |
| 26360 | bool is_duplicate; |
| 26361 | if (create_internal_tmp_table_from_heap(join->thd, table, |
| 26362 | join_tab->tmp_table_param->start_recinfo, |
| 26363 | &join_tab->tmp_table_param->recinfo, |
| 26364 | error, 1, &is_duplicate)) |
| 26365 | DBUG_RETURN(NESTED_LOOP_ERROR); // Not a table_is_full error |
| 26366 | if (is_duplicate) |
| 26367 | goto end; |
| 26368 | } |
| 26369 | if (++join_tab->send_records >= |
| 26370 | join_tab->tmp_table_param->end_write_records && |
| 26371 | join->do_send_rows) |
| 26372 | { |
| 26373 | if (!(join->select_options & OPTION_FOUND_ROWS)) |
| 26374 | DBUG_RETURN(NESTED_LOOP_QUERY_LIMIT); |
| 26375 | join->do_send_rows=0; |
| 26376 | join->unit->lim.set_unlimited(); |
| 26377 | } |
| 26378 | } |
| 26379 | } |
| 26380 | end: |
| 26381 | if (unlikely(join->thd->check_killed())) |
| 26382 | { |
| 26383 | DBUG_RETURN(NESTED_LOOP_KILLED); /* purecov: inspected */ |
| 26384 | } |
| 26385 | DBUG_RETURN(NESTED_LOOP_OK); |
| 26386 | } |
| 26387 | |
| 26388 | |
| 26389 | /* |
nothing calls this directly
no test coverage detected