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

Method insertRecord

src/jrd/replication/Replicator.cpp:295–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293}
294
295void Replicator::insertRecord(CheckStatusWrapper* status,
296 Transaction* transaction,
297 const char* relName,
298 IReplicatedRecord* record)
299{
300 try
301 {
302 for (unsigned id = 0; id < record->getCount(); id++)
303 {
304 IReplicatedField* field = record->getField(id);
305 if (field != nullptr)
306 {
307 auto type = field->getType();
308 if (type == SQL_ARRAY || type == SQL_BLOB)
309 {
310 const auto blobId = (ISC_QUAD*) field->getData();
311
312 if (blobId && !BlobWrapper::blobIsNull(*blobId))
313 storeBlob(transaction, *blobId);
314 }
315 }
316 }
317
318 const auto length = record->getRawLength();
319 const auto data = record->getRawData();
320
321 auto& txnData = transaction->getData();
322
323 const auto atom = txnData.defineAtom(relName);
324
325 txnData.putTag(opInsertRecord);
326 txnData.putInt32(atom);
327 txnData.putInt32(length);
328 txnData.putBinary(length, data);
329
330 if (txnData.getSize() > m_config->bufferSize)
331 flush(txnData, FLUSH_OVERFLOW);
332 }
333 catch (const Exception& ex)
334 {
335 ex.stuffException(status);
336 }
337}
338
339void Replicator::updateRecord(CheckStatusWrapper* status,
340 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