MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / REPL_modify

Function REPL_modify

src/jrd/replication/Publisher.cpp:537–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

535}
536
537void REPL_modify(thread_db* tdbb, const record_param* orgRpb,
538 const record_param* newRpb, jrd_tra* transaction)
539{
540 if (tdbb->tdbb_flags & (TDBB_dont_post_dfw | TDBB_repl_in_progress))
541 return;
542
543 const auto relation = newRpb->rpb_relation;
544 fb_assert(relation);
545
546 if (!checkTable(tdbb, relation))
547 return;
548
549 FbLocalStatus status;
550 const auto replicator = getReplicator(tdbb, status, transaction);
551 if (!replicator)
552 return;
553
554 const auto newRecord = upgradeRecord(tdbb, relation, newRpb->rpb_record);
555 fb_assert(newRecord);
556
557 const auto orgRecord = upgradeRecord(tdbb, relation, orgRpb->rpb_record);
558 fb_assert(orgRecord);
559
560 // These temporary auto-pointers are just to delete temporary records
561 AutoPtr<Record> cleanupOrgRecord(orgRecord != orgRpb->rpb_record ? orgRecord : nullptr);
562 AutoPtr<Record> cleanupNewRecord(newRecord != newRpb->rpb_record ? newRecord : nullptr);
563
564 const auto orgLength = orgRecord->getLength();
565 const auto newLength = newRecord->getLength();
566
567 // Ignore dummy updates
568 if (orgLength == newLength &&
569 !memcmp(orgRecord->getData(), newRecord->getData(), orgLength))
570 {
571 return;
572 }
573
574 AutoSetRestoreFlag<ULONG> noRecursion(&tdbb->tdbb_flags, TDBB_repl_in_progress, true);
575 AutoSetRestoreFlag<ULONG> noBlobCheck(&transaction->tra_flags, TRA_no_blob_check, true);
576
577 ReplicatedRecordImpl replOrgRecord(tdbb, relation, orgRecord);
578 ReplicatedRecordImpl replNewRecord(tdbb, relation, newRecord);
579
580 replicator->updateRecord(&status,
581 relation->rel_name.c_str(),
582 &replOrgRecord, &replNewRecord);
583
584 checkStatus(tdbb, status, transaction);
585}
586
587
588void REPL_erase(thread_db* tdbb, const record_param* rpb, jrd_tra* transaction)

Callers 2

modifyMethod · 0.85
doUpdateMethod · 0.85

Calls 8

checkTableFunction · 0.85
getReplicatorFunction · 0.85
upgradeRecordFunction · 0.85
checkStatusFunction · 0.85
getLengthMethod · 0.45
getDataMethod · 0.45
updateRecordMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected