Solve prepare memory leak in Oracle


When using prepared queries on big datasets in oracle 8.0.4 every time when
opening it it leaks some memory which causes 'Not enough memory for this
operation' after a while.

In BDEReadme.Txt you can find the following remark:

Memory leakage when executing a query many times.
Workaround : call DbiQFree() and DbiQPrepare() every time
the query is executed.

In BDE32 help you can find:

function DbiQPrepare (hStmt: hDBIStmt; pszQuery: PChar): DBIResult stdcall;
DbiQPrepare prepares a SQL or QBE query for execution, and accepts a handle
to a statement containing the prepared query.

hStmt Type: hDBIStmt (Input)
Specifies the statement handle
pszQuery Type: pCHAR (Input)
Pointer to the query, formulated in the appropriate language.

function DbiQFree (var hStmt: hDBIStmt): DBIResult stdcall;
DbiQFree frees the resources associated with a previously allocated query
identified by the supplied statement handle.

Can someone help me with an example how to use these functions and how to
fill the parameters?
Is there another workaround?

Please Email me:

Thanks in advance

Stefan Cruysberghs