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

Method write_record

sql/sql_insert.cc:2422–2450  ·  view source on GitHub ↗

Write a record to table with optional deleting of conflicting records, invoke proper triggers if needed. @note Once this record will be written to table after insert trigger will be invoked. If instead of inserting new record we will update old one then both on update triggers will work instead. Similarly both on delete triggers will be invoked if we will delete conflicting re

Source from the content-addressed store, hash-verified

2420 non-0 - error
2421*/
2422int Write_record::write_record()
2423{
2424 ha_rows inserted= 0, updated= 0;
2425 prev_insert_id= table->file->next_insert_id;
2426 info->records++;
2427 ignored_error= false;
2428 int res= 0;
2429 switch(info->handle_duplicates)
2430 {
2431 case DUP_ERROR:
2432 res= single_insert(&inserted);
2433 break;
2434 case DUP_UPDATE:
2435 res= insert_on_duplicate_update(&inserted, &updated);
2436 info->updated+= updated;
2437 break;
2438 case DUP_REPLACE:
2439 res= replace_row(&inserted, &updated);
2440 if (versioned)
2441 info->updated+= updated;
2442 else
2443 info->deleted+= updated;
2444 }
2445
2446 info->copied+= inserted;
2447 if (inserted || updated)
2448 notify_non_trans_table_modified();
2449 return res;
2450}
2451
2452
2453int Write_record::prepare_handle_duplicate(int error)

Callers 3

mysql_insertFunction · 0.45
handle_insertsMethod · 0.45
send_dataMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected