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
| 2420 | non-0 - error |
| 2421 | */ |
| 2422 | int 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 | |
| 2453 | int Write_record::prepare_handle_duplicate(int error) |
no outgoing calls
no test coverage detected