Subject Re: [IBO] Detecting StartTransaction
Author bhatakeyama
"Helen Borrie (TeamIBO)" wrote:

> At 07:08 PM 27-04-02 -0700, bhata wrote:
> >Daniel Rail wrote:
> >
> > > At 04/27/2002 04:23 PM, you wrote:
> > > >Is there a way to detect a StartTransaction for a TIB_Database?
> > >
> > > Look at TIB_Transaction.AfterStart event.
> >
> >That's what I thought. But when I put a breakpoint on it, it
> >only broke at the beginning of the program and InTransaction
> >is still false. I execute a StartTransaction from a TButton and
> >it doesn't break. Can you verify?
> You can't intervene in the StartTransaction method. Don't test
> InTransaction, since this relates to the logical transaction but does not
> necessarily indicate whether the transaction is active. You should be
> testing the TransactionIsActive property to determine whether a physical
> transaction has started.

Hi Helen,

I wrote a test program where I can reopen the TIB_Database and
TIB_Query. This results with both InTransaction and TransactionIsActive
being false.

If I execute a StartTransaction() it results in:
InTransaction == true
TransactionIsActive == false
Restarting, when I edit a field in a TIB_Grid it results in:
InTransaction == false
TransactionIsActive == true
Restarting, if I execute a StartTransaction() followed by a TIB_Grid edit it results in:
InTransaction == true
TransactionIsActive == true

I'm confused with the terminology in the help file. For
TransactionIsActive it says "This property works for both the
implicit and explicit logical transaction modes." Doesn't "explicit"
mean executing StartTransaction?

Basically I would like to trap the situation where
InTransaction == false
TransactionIsActive == true
Because I am trying to always do an "Explicit" transaction, I want
to know if I inadvertently allow an "Implcit" transaction. Is there
a way to trap this situation?