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

Function end_write

sql/sql_select.cc:26338–26386  ·  view source on GitHub ↗

ARGSUSED */

Source from the content-addressed store, hash-verified

26336
26337 /* ARGSUSED */
26338static enum_nested_loop_state
26339end_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 }
26380end:
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/*

Callers

nothing calls this directly

Calls 7

copy_fieldsFunction · 0.85
copy_funcsFunction · 0.85
set_unlimitedMethod · 0.80
check_killedMethod · 0.80
val_boolMethod · 0.45
is_fatal_errorMethod · 0.45

Tested by

no test coverage detected