Subject Re: [IBO] How to get TIB_Transaction from IBOTable object?
Author Helen Borrie
At 06:25 PM 4/05/2005 +0200, you wrote:
>Helen Borrie wrote:
> >At 04:54 PM 4/05/2005 +0200, you wrote:
> >
> >
> >>I've got an IBOTable with <default> IB_Transaction and
> >>DatabaseName='mydatabase'. How do I get TIB_Transaction object used by
> >>this IBOTable? I want certain piece of code to wark in all
> >>circumstances, so I cannot asume that 'mydatabase' is known...
> >>
> >>
> >
> >Refer to the IB_Transaction property of the IBOTable object.
> >
> >e.g.
> >
> >if not MyTable.IB_Transaction.Started then
> > MyTable.IB_Transaction.StartTransaction;
> >
> >Helen
> >
> >
>Have you actually tried that? In C++ Builder IB_Transaction returns NULL
>default transaction is used...

That is quite likely, since the default transaction is created when it is
needed and simply may not be available at the time you refer to it.

If you are using TIBODatabase, there is one transaction built in and you
refer to it through properrties of the IBODatabase object. If you are
using TIB_Connection instead, drop a TIBOTransaction or TIB_Transaction
into your datamodule and select it as the DefaultTransaction property for
the IB_Connection.

Also set the IB_Connection property of your IBOTable - then IBO will take
care of the DatabaseName property, and you will not get the situation where
the TIBOTable creates its own internal transaction.