Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 21 additions & 30 deletions src/jrd/replication/Replicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,21 +306,7 @@ void Replicator::insertRecord(CheckStatusWrapper* status,
{
try
{
for (unsigned id = 0; id < record->getCount(); id++)
{
IReplicatedField* field = record->getField(id);
if (field != nullptr)
{
const auto type = field->getType();
if (type == SQL_ARRAY || type == SQL_BLOB)
{
const auto* blobId = (ISC_QUAD*) field->getData();

if (blobId && !BlobWrapper::blobIsNull(*blobId))
storeBlob(transaction, *blobId);
}
}
}
storeBlobs(transaction, record);

const auto length = record->getRawLength();
const auto data = record->getRawData();
Expand Down Expand Up @@ -353,21 +339,7 @@ void Replicator::updateRecord(CheckStatusWrapper* status,
{
try
{
for (unsigned id = 0; id < newRecord->getCount(); id++)
{
IReplicatedField* field = newRecord->getField(id);
if (field != nullptr)
{
const auto type = field->getType();
if (type == SQL_ARRAY || type == SQL_BLOB)
{
const auto* blobId = (ISC_QUAD*) field->getData();

if (blobId && !BlobWrapper::blobIsNull(*blobId))
storeBlob(transaction, *blobId);
}
}
}
storeBlobs(transaction, newRecord);

const auto orgLength = orgRecord->getRawLength();
const auto orgData = orgRecord->getRawData();
Expand Down Expand Up @@ -454,6 +426,25 @@ void Replicator::executeSqlIntl(CheckStatusWrapper* status,
}
}

void Replicator::storeBlobs(Transaction* transaction, Firebird::IReplicatedRecord* record)
{
for (unsigned id = 0; id < newRecord->getCount(); id++)
{
IReplicatedField* field = newRecord->getField(id);
if (field == nullptr)
continue;

const auto type = field->getType();
if (type == SQL_ARRAY || type == SQL_BLOB)
{
const auto* blobId = (ISC_QUAD*) field->getData();

if (blobId && !BlobWrapper::blobIsNull(*blobId))
storeBlob(transaction, *blobId);
}
}
}

void Replicator::cleanupTransaction(CheckStatusWrapper* status,
SINT64 number)
{
Expand Down
2 changes: 2 additions & 0 deletions src/jrd/replication/Replicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ namespace Replication
unsigned charset,
const char* schemaSearchPath,
const char* sql);

void storeBlobs(Transaction* transaction, Firebird::IReplicatedRecord* record);
};

} // namespace
Expand Down
Loading