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

Method updateRecord

src/jrd/replication/Replicator.cpp:339–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337}
338
339void Replicator::updateRecord(CheckStatusWrapper* status,
340 Transaction* transaction,
341 const char* relName,
342 IReplicatedRecord* orgRecord,
343 IReplicatedRecord* newRecord)
344{
345 try
346 {
347 for (unsigned id = 0; id < newRecord->getCount(); id++)
348 {
349 IReplicatedField* field = newRecord->getField(id);
350 if (field != nullptr)
351 {
352 auto type = field->getType();
353 if (type == SQL_ARRAY || type == SQL_BLOB)
354 {
355 const auto blobId = (ISC_QUAD*) field->getData();
356
357 if (blobId && !BlobWrapper::blobIsNull(*blobId))
358 storeBlob(transaction, *blobId);
359 }
360 }
361 }
362
363 const auto orgLength = orgRecord->getRawLength();
364 const auto orgData = orgRecord->getRawData();
365
366 const auto newLength = newRecord->getRawLength();
367 const auto newData = newRecord->getRawData();
368
369 auto& txnData = transaction->getData();
370
371 const auto atom = txnData.defineAtom(relName);
372
373 txnData.putTag(opUpdateRecord);
374 txnData.putInt32(atom);
375 txnData.putInt32(orgLength);
376 txnData.putBinary(orgLength, orgData);
377 txnData.putInt32(newLength);
378 txnData.putBinary(newLength, newData);
379
380 if (txnData.getSize() > m_config->bufferSize)
381 flush(txnData, FLUSH_OVERFLOW);
382 }
383 catch (const Exception& ex)
384 {
385 ex.stuffException(status);
386 }
387}
388
389void Replicator::deleteRecord(CheckStatusWrapper* status,
390 Transaction* transaction,

Callers

nothing calls this directly

Calls 12

putTagMethod · 0.80
putInt32Method · 0.80
putBinaryMethod · 0.80
getCountMethod · 0.45
getFieldMethod · 0.45
getTypeMethod · 0.45
getDataMethod · 0.45
getRawLengthMethod · 0.45
getRawDataMethod · 0.45
defineAtomMethod · 0.45
getSizeMethod · 0.45
stuffExceptionMethod · 0.45

Tested by

no test coverage detected