Subject Re: [IBO] Problem with resources (DSQL) not being freed
Author Jason Wharton
Try using First instead of APIFirst and let me know what it does.

Thanks,
Jason Wharton
CPS - Computer Programming Solutions
Mesa Arizona
http://www.ibobjects.com

-- We may not have it all together --
-- But together we have it all --

----- Original Message -----
From: "birdpointy" <gary@...>
To: <IBObjects@yahoogroups.com>
Sent: Tuesday, April 01, 2003 7:37 AM
Subject: [IBO] Problem with resources (DSQL) not being freed


> Hi
>
> Not sure if this is my fault, but I dont think so.
>
> I have an application which runs for weeks without being shut down,
> but eventually crashes. It uses a TIB_Cursor to poll a database for
> new information with the following piece of code:
>
> WCursor := TIB_Cursor.Create(Self);
> try
> WCursor.IB_Connection := Conn;
> WCursor.SQL.Text := 'SELECT * FROM FAXQ WHERE STATUS=0 FOR
> UPDATE';
> WCursor.APIFirst; // This line is causing the problem
> if WCursor.Eof then begin
> Log.Lines.Add('No faxes found ....');
> Shape.Brush.Color := COLOR_INACTIVE;
> Conn.Disconnect;
> Exit;
> end else begin
> ....
> // do some other stuff
> ....
> end;
> finally
> WCursor.Unprepare;
> WCursor.Free;
> Conn.Disconnect;
> end;
>
> When I call APIFirst, resources are being allocated that are not
> unallocated - I am using a program called MemProof to check this, and
> it reports that the API call (isc_dsql_prepare) is not freeing the
> resources as required. Is this a IBO issue or a gds32.dll issue, or
> is there something I am not understanding.
>
> I have run the app with the APIFirst commented out and the resources
> are not affected at all. Do I need to call WCursor.Prepare explicitly?
>
> Any help would be appreciated.
>
> Best wishes
>
> Gary
>