| 551 | } |
| 552 | |
| 553 | YTransaction* DtcStart::start(CheckStatusWrapper* status) |
| 554 | { |
| 555 | try |
| 556 | { |
| 557 | status->init(); |
| 558 | |
| 559 | RefPtr<DTransaction> dtransaction(FB_NEW DTransaction); |
| 560 | |
| 561 | unsigned cnt = components.getCount(); |
| 562 | if (status->getState() & IStatus::STATE_ERRORS) |
| 563 | status_exception::raise(status); |
| 564 | if (cnt == 0) |
| 565 | (Arg::Gds(isc_random) << "No attachments to start distributed transaction provided").raise(); |
| 566 | |
| 567 | for (unsigned i = 0; i < cnt; ++i) |
| 568 | { |
| 569 | ITransaction* started = components[i].att->startTransaction(status, components[i].tpbLen, components[i].tpb); |
| 570 | if (status->getState() & IStatus::STATE_ERRORS) |
| 571 | status_exception::raise(status); |
| 572 | |
| 573 | dtransaction->join(status, started); |
| 574 | if (status->getState() & IStatus::STATE_ERRORS) |
| 575 | { |
| 576 | started->release(); |
| 577 | status_exception::raise(status); |
| 578 | } |
| 579 | } |
| 580 | |
| 581 | YTransaction* rc = FB_NEW YTransaction(NULL, dtransaction); |
| 582 | rc->addRef(); |
| 583 | dtransaction->addRef(); |
| 584 | this->dispose(); |
| 585 | return rc; |
| 586 | } |
| 587 | catch (const Exception& ex) |
| 588 | { |
| 589 | ex.stuffException(status); |
| 590 | } |
| 591 | |
| 592 | return NULL; |
| 593 | } |
| 594 | |
| 595 | YTransaction* Dtc::join(CheckStatusWrapper* status, ITransaction* one, ITransaction* two) |
| 596 | { |
nothing calls this directly
no test coverage detected