| 455 | } |
| 456 | |
| 457 | Firebird::IBatchCompletionState* DsqlBatch::execute(thread_db* tdbb) |
| 458 | { |
| 459 | // todo - add new trace event here |
| 460 | // TraceDSQLExecute trace(req_dbb->dbb_attachment, this); |
| 461 | |
| 462 | jrd_tra* transaction = tdbb->getTransaction(); |
| 463 | |
| 464 | // execution timer |
| 465 | thread_db::TimerGuard timerGuard(tdbb, m_dsqlRequest->setupTimer(tdbb), true); |
| 466 | |
| 467 | // sync internal buffers |
| 468 | m_messages.done(); |
| 469 | |
| 470 | // insert blobs here |
| 471 | if (m_blobMeta.hasData()) |
| 472 | { |
| 473 | // This code expects the following to work correctly |
| 474 | fb_assert(RAM_BATCH % BLOB_STREAM_ALIGN == 0); |
| 475 | |
| 476 | blobSetSize(); // needed after appendBlobData() |
| 477 | m_blobs.done(); // sync internal buffers |
| 478 | |
| 479 | struct BlobFlow |
| 480 | { |
| 481 | ULONG remains; |
| 482 | UCHAR* data; |
| 483 | ULONG currentBlobSize; |
| 484 | ULONG byteCount; |
| 485 | |
| 486 | BlobFlow() |
| 487 | : remains(0), data(NULL), currentBlobSize(0), byteCount(0) |
| 488 | { } |
| 489 | |
| 490 | void newHdr(ULONG blobSize) |
| 491 | { |
| 492 | currentBlobSize = blobSize; |
| 493 | move3(SIZEOF_BLOB_HEAD); |
| 494 | } |
| 495 | |
| 496 | void move(ULONG step) |
| 497 | { |
| 498 | move3(step); |
| 499 | currentBlobSize -= step; |
| 500 | } |
| 501 | |
| 502 | bool align(ULONG alignment) |
| 503 | { |
| 504 | ULONG a = byteCount % alignment; |
| 505 | if (a) |
| 506 | { |
| 507 | a = alignment - a; |
| 508 | move3(a); |
| 509 | if (currentBlobSize) |
| 510 | currentBlobSize -= a; |
| 511 | } |
| 512 | return a; |
| 513 | } |
| 514 |
nothing calls this directly
no test coverage detected