Start a transaction.
| 3580 | |
| 3581 | // Start a transaction. |
| 3582 | ISC_STATUS API_ROUTINE isc_start_multiple(ISC_STATUS* userStatus, isc_tr_handle* traHandle, |
| 3583 | SSHORT count, void* vec) |
| 3584 | { |
| 3585 | StatusVector status(userStatus); |
| 3586 | CheckStatusWrapper statusWrapper(&status); |
| 3587 | TEB* vector = (TEB*) vec; |
| 3588 | YTransaction* multiTrans = NULL; |
| 3589 | |
| 3590 | try |
| 3591 | { |
| 3592 | nullCheck(traHandle, isc_bad_trans_handle); |
| 3593 | |
| 3594 | if (count <= 0 || !vector) |
| 3595 | status_exception::raise(Arg::Gds(isc_bad_teb_form)); |
| 3596 | |
| 3597 | if (count == 1) |
| 3598 | { |
| 3599 | RefPtr<YAttachment> attachment(translateHandle(attachments, vector->teb_database)); |
| 3600 | |
| 3601 | YTransaction* transaction = attachment->startTransaction(&statusWrapper, |
| 3602 | vector->teb_tpb_length, vector->teb_tpb); |
| 3603 | |
| 3604 | if (transaction) |
| 3605 | *traHandle = transaction->getHandle(); |
| 3606 | |
| 3607 | return status[1]; |
| 3608 | } |
| 3609 | |
| 3610 | DtcStart* ds = MasterImplementation::dtc->startBuilder(&statusWrapper); |
| 3611 | if (statusWrapper.getState() & IStatus::STATE_ERRORS) |
| 3612 | return status[1]; |
| 3613 | |
| 3614 | for (SSHORT i = 0; i < count; ++i, ++vector) |
| 3615 | { |
| 3616 | RefPtr<YAttachment> attachment(translateHandle(attachments, vector->teb_database)); |
| 3617 | ds->addWithTpb(&statusWrapper, attachment, vector->teb_tpb_length, |
| 3618 | reinterpret_cast<const unsigned char*>(vector->teb_tpb)); |
| 3619 | |
| 3620 | if (statusWrapper.getState() & IStatus::STATE_ERRORS) |
| 3621 | { |
| 3622 | ds->dispose(); |
| 3623 | return status[1]; |
| 3624 | } |
| 3625 | } |
| 3626 | |
| 3627 | multiTrans = ds->start(&statusWrapper); |
| 3628 | if (!multiTrans) |
| 3629 | { |
| 3630 | ds->dispose(); |
| 3631 | return status[1]; |
| 3632 | } |
| 3633 | |
| 3634 | *traHandle = multiTrans->getHandle(); |
| 3635 | } |
| 3636 | catch (const Exception& e) |
| 3637 | { |
| 3638 | if (multiTrans) |
| 3639 | multiTrans->release(); |
nothing calls this directly
no test coverage detected