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

Method send_data

sql/sql_update.cc:2405–2583  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2403
2404
2405int multi_update::send_data(List<Item> &not_used_values)
2406{
2407 TABLE_LIST *cur_table;
2408 DBUG_ENTER("multi_update::send_data");
2409
2410 for (cur_table= update_tables; cur_table; cur_table= cur_table->next_local)
2411 {
2412 int error= 0;
2413 TABLE *table= cur_table->table;
2414 uint offset= cur_table->shared;
2415 /*
2416 Check if we are using outer join and we didn't find the row
2417 or if we have already updated this row in the previous call to this
2418 function.
2419
2420 The same row may be presented here several times in a join of type
2421 UPDATE t1 FROM t1,t2 SET t1.a=t2.a
2422
2423 In this case we will do the update for the first found row combination.
2424 The join algorithm guarantees that we will not find the a row in
2425 t1 several times.
2426 */
2427 if (table->status & (STATUS_NULL_ROW | STATUS_UPDATED))
2428 continue;
2429
2430 if (table == table_to_update)
2431 {
2432 /*
2433 We can use compare_record() to optimize away updates if
2434 the table handler is returning all columns OR if
2435 if all updated columns are read
2436 */
2437 bool can_compare_record;
2438 can_compare_record= records_are_comparable(table);
2439
2440 table->status|= STATUS_UPDATED;
2441 store_record(table,record[1]);
2442
2443 bool trg_skip_row= false;
2444 if (fill_record_n_invoke_before_triggers(thd, table,
2445 *fields_for_table[offset],
2446 *values_for_table[offset], 0,
2447 TRG_EVENT_UPDATE,
2448 &trg_skip_row))
2449 DBUG_RETURN(1);
2450
2451 if (trg_skip_row)
2452 continue;
2453
2454 /*
2455 Reset the table->auto_increment_field_not_null as it is valid for
2456 only one row.
2457 */
2458 table->auto_increment_field_not_null= FALSE;
2459 found++;
2460 if (!can_compare_record || compare_record(table))
2461 {
2462

Callers 1

update_single_tableMethod · 0.45

Calls 15

records_are_comparableFunction · 0.85
vers_insert_history_rowFunction · 0.85
copy_funcsFunction · 0.85
fill_recordFunction · 0.85
view_check_optionMethod · 0.80
ha_update_rowMethod · 0.80
compare_recordFunction · 0.70
extraMethod · 0.45

Tested by

no test coverage detected