Subject RE: [IBO] Re: Create TIB_Transaction and TIB_StoredProc with code ...
Author jwharton@ibobjects.com
Do not use nil owners in constructors with IBO components. (when doing multi-threaded stuff)
The only IBO component that is fine with a nil owner is TIB_Session and then use it as the owner for the rest of the
components.

Jason Wharton
www.ibobjects.com

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
I think the AddConnection is only if you wish to have connections to multiple databases. For the single database

FTransaction.IB_Connection := Connection;


Should work.

I created TIB_Connection and TIB_Transaction in code as follows

Procedure foo;
VAR
IB_Connection: TIB_Connection;
IB_Transaction: TIB_Transaction;
BEGIN
IB_Connection := TIB_Connection.Create(nil);
IB_Transaction := TIB_Transaction.Create(nil);

IB_Connection.DefaultTransaction := IB_Transaction;
IB_Connection.OnError := IB_ConnectionError;
END;

Don't forget to clean up afterwards with something like

Procedure bar;
BEGIN
IB_Transaction.Free;
IB_Connection.Free;
END;

This worked just fine for me ...


Eric Tishler
Software Architect
Resolute Partners, LLC
Phone: 203.271.1122
Fax: 203.271.1460
etishler@...

-----Original Message-----
From: tractaylor [mailto:tractaylor@...]
Sent: Thursday, April 01, 2004 3:45 PM
To: IBObjects@yahoogroups.com
Subject: [IBO] Re: Create TIB_Transaction and TIB_StoredProc with code ...

I am not really sure what the problem is, but I think you need to add
the connection to the IB_Transaction like this :

FTransaction.AddConnection(Connection);

instead of

FTransaction.IB_Connection := Connection;

But again, are you getting errors or something? If so, what are they?


Hope this helps.

Trac