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

Function end_update

sql/sql_select.cc:26413–26489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26411*/
26412
26413static enum_nested_loop_state
26414end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
26415 bool end_of_records)
26416{
26417 TABLE *const table= join_tab->table;
26418 ORDER *group;
26419 int error;
26420 DBUG_ENTER("end_update");
26421
26422 if (end_of_records)
26423 DBUG_RETURN(NESTED_LOOP_OK);
26424
26425 join->found_records++;
26426 copy_fields(join_tab->tmp_table_param); // Groups are copied twice.
26427 /* Make a key of group index */
26428 for (group=table->group ; group ; group=group->next)
26429 {
26430 Item *item= *group->item;
26431 if (group->fast_field_copier_setup != group->field)
26432 {
26433 DBUG_PRINT("info", ("new setup %p -> %p",
26434 group->fast_field_copier_setup,
26435 group->field));
26436 group->fast_field_copier_setup= group->field;
26437 group->fast_field_copier_func=
26438 item->setup_fast_field_copier(group->field);
26439 }
26440 item->save_org_in_field(group->field, group->fast_field_copier_func);
26441 /* Store in the used key if the field was 0 */
26442 if (item->maybe_null())
26443 group->buff[-1]= (char) group->field->is_null();
26444 }
26445 if (!table->file->ha_index_read_map(table->record[1],
26446 join_tab->tmp_table_param->group_buff,
26447 HA_WHOLE_KEY,
26448 HA_READ_KEY_EXACT))
26449 { /* Update old record */
26450 restore_record(table,record[1]);
26451 update_tmptable_sum_func(join->sum_funcs,table);
26452 if (unlikely((error= table->file->ha_update_tmp_row(table->record[1],
26453 table->record[0]))))
26454 {
26455 table->file->print_error(error,MYF(0)); /* purecov: inspected */
26456 DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */
26457 }
26458 goto end;
26459 }
26460
26461 init_tmptable_sum_functions(join->sum_funcs);
26462 if (unlikely(copy_funcs(join_tab->tmp_table_param->items_to_copy,
26463 join->thd)))
26464 DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */
26465 if (unlikely((error= table->file->ha_write_tmp_row(table->record[0]))))
26466 {
26467 if (create_internal_tmp_table_from_heap(join->thd, table,
26468 join_tab->tmp_table_param->start_recinfo,
26469 &join_tab->tmp_table_param->recinfo,
26470 error, 0, NULL))

Callers

nothing calls this directly

Calls 14

copy_fieldsFunction · 0.85
update_tmptable_sum_funcFunction · 0.85
copy_funcsFunction · 0.85
ha_index_read_mapMethod · 0.80
ha_index_initMethod · 0.80
set_write_funcMethod · 0.80
check_killedMethod · 0.80
save_org_in_fieldMethod · 0.45
maybe_nullMethod · 0.45

Tested by

no test coverage detected