| 337 | } |
| 338 | |
| 339 | void 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 | |
| 389 | void Replicator::deleteRecord(CheckStatusWrapper* status, |
| 390 | Transaction* transaction, |
nothing calls this directly
no test coverage detected