Subject | Re: [IBO] More on resources not being freed |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2003-04-02T07:51:16Z |
Gary,
why do you use APIFirst and not simply First? And where is your ib_transaction?
Here's how I guess I would have done something similar to what you're doing:
procedure TForm1.Button1Click(Sender: TObject);
var
WCursor: TIB_Cursor;
begin
try
Conn.Connect;
WCursor:=TIB_Cursor.Create(Self);
WCursor.IB_Connection:=Conn;
WCursor.IB_Transaction:=Trans; //This one of course have to exist and
it's IB_Connection property point to Conn
WCursor.SQL.Add('SELECT * FROM CUSTOMER');
WCursor.First; //This implicitly start the transaction.
WCursor.Close;
finally
if Assigned(WCursor) then //not quite certain about this, I rarely
create cursors through code
WCursor.Free;
if Transaction.TransactionIsActive then
Trans.Commit;
if Conn.Connected then
Conn.Disconnect;
end;
end;
HTH,
Set
why do you use APIFirst and not simply First? And where is your ib_transaction?
Here's how I guess I would have done something similar to what you're doing:
procedure TForm1.Button1Click(Sender: TObject);
var
WCursor: TIB_Cursor;
begin
try
Conn.Connect;
WCursor:=TIB_Cursor.Create(Self);
WCursor.IB_Connection:=Conn;
WCursor.IB_Transaction:=Trans; //This one of course have to exist and
it's IB_Connection property point to Conn
WCursor.SQL.Add('SELECT * FROM CUSTOMER');
WCursor.First; //This implicitly start the transaction.
WCursor.Close;
finally
if Assigned(WCursor) then //not quite certain about this, I rarely
create cursors through code
WCursor.Free;
if Transaction.TransactionIsActive then
Trans.Commit;
if Conn.Connected then
Conn.Disconnect;
end;
end;
HTH,
Set