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

Method send_data

sql/sql_delete.cc:1395–1489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1393
1394
1395int multi_delete::send_data(List<Item> &values)
1396{
1397 int secure_counter= delete_while_scanning ? -1 : 0;
1398 TABLE_LIST *del_table;
1399 DBUG_ENTER("multi_delete::send_data");
1400
1401 bool ignore= thd->lex->ignore;
1402
1403 for (del_table= delete_tables;
1404 del_table;
1405 del_table= del_table->next_local, ++secure_counter)
1406 {
1407 TABLE *table= del_table->table;
1408 // DELETE and TRUNCATE don't affect SEQUENCE, so bail early
1409 if (table->file->ht->db_type == DB_TYPE_SEQUENCE)
1410 continue;
1411
1412 /* Check if we are using outer join and we didn't find the row */
1413 if (table->status & (STATUS_NULL_ROW | STATUS_DELETED))
1414 continue;
1415
1416 table->file->position(table->record[0]);
1417 ++found;
1418
1419 if (secure_counter < 0)
1420 {
1421 bool trg_skip_row= false;
1422
1423 /* We are scanning the current table */
1424 DBUG_ASSERT(del_table == table_being_deleted);
1425 if (table->triggers &&
1426 table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
1427 TRG_ACTION_BEFORE, false,
1428 &trg_skip_row))
1429 DBUG_RETURN(1);
1430
1431 if (trg_skip_row)
1432 continue;
1433
1434 table->status|= STATUS_DELETED;
1435
1436 error= table->delete_row();
1437 if (likely(!error))
1438 {
1439 deleted++;
1440 if (!table->file->has_transactions())
1441 thd->transaction->stmt.modified_non_trans_table= TRUE;
1442 if (table->triggers &&
1443 table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
1444 TRG_ACTION_AFTER, false,
1445 nullptr))
1446 DBUG_RETURN(1);
1447 }
1448 else if (!ignore)
1449 {
1450 /*
1451 If the IGNORE option is used errors caused by ha_delete_row don't
1452 have to stop the iteration.

Callers 1

Calls 8

copy_funcsFunction · 0.85
has_transactionsMethod · 0.80
positionMethod · 0.45
process_triggersMethod · 0.45
delete_rowMethod · 0.45
print_errorMethod · 0.45
is_nullMethod · 0.45

Tested by

no test coverage detected