Subject Re: [IBO] Nested Transactions?
Author Helen Borrie (TeamIBO)
At 04:00 AM 23-05-02 +0000, you wrote:
>Hello,
>
> (BCB4, IBO4_Gc, FB1)
>
> Say I have a form with transaction BigTrans, which calls another
>form with transaction LittleTrans. I want the following things:
> 1) If the user cancels the changes in the inner form, then
>LittleTrans is rolled-back without affecting BigTrans. (No problem
>here).
> 2) If the user saves the changes in the inner form, then the
>changes in LittleTrans become part of the changes in BigTrans. This
>is because each invocation of the inner form will result in a
>separate transaction instance. For example, the user may invoke this
>inner form 5 times during the lifetime of the BigTrans, and may only
>want to save the changes from 3 of these invocations.
>
> Is #2 possible?

Nope. InterBase doesn't support nested transactions. The only solution
available to make the whole "Big Thing" rollback-able is not to commit what
you call the "inner transactions" but to keep everything within the same
transaction.

IBO helps you, though. Look at the TIB_TransactionSource - you can place
this on your child form and, in the OnCreate, hook it up to the transaction
on the main form. Start a new transaction before you create the child form
(or before the door opens for the child form activity to begin). On the
child form, provide some sort of a Go/Cancel mechanism for the user in case
s/he changes her mind. Don't do a row-by-row commit on the child form
: just post the work from the child form and let the main form take care
of committing or rolling it back.

regards,
Helen Borrie (TeamIBO Support)

** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com