Subject Re: [IBO] How can I load a query in memory?
Author Helen Borrie (TeamIBO)
At 07:59 PM 06-04-02 +0000, pepemallorca wrote:
>Hello:
>
>Is posible in IBO load a query in memory?

The initial answer is "yes", if you are using the TDataset
architecture. There is a freeware memory table component by Kim Bo Madsen
called TkbmMemTable that is compatible with that. Kim's contact address is
kbm@....


>If you need more help, my problem is the next:
>
>======================================================
>
>* I have to do a bucle (for example of 320.000 iterations).

What is a "bucle"?


>* In each iteration, I have to search a value in the query (that I
>hope it was in memory).
>
>* A good thing: this table will not change in all the iterations.
>
>--
>
>I think in some solutions:
>
>1) Before begin the bucle, I can load this records (not all the
>table) in a StringList or similar, and in the bucle, search in the
>StringList (this is in memory). I think it's no the best method. So
>manual !!!
>
>2) Write an IF LOCATE line inside the bucle. I'll test it but is
>very slowly (the search is with 2 fields). I have test to write an
>Qry.readonly:=true
>Qry.fetchall;
>Qry.prepare;
>...
>
>to increase speed (the result is the same...)
>
>
>3) Call to an stored procedure with the select (it uses the primary
>key index). Slowly. More similar to (2)
>
>
>Exists in IBO an alternative to 2) or 3) and load the query in
>memory.

This approach is entirely wrong-footed for a client/server
application. Instead of bringing a huge dataset across to the client and
operating on it client side, you should keep the data on the server and
bring only the RESULTS of the search across to the client.

Use your client app to collect parameters from the user and pass these to a
query that performs the operation **on the server**. LOCATE is really a
Paradox concept - to perform well, it presumes that the physical database
and the client are sharing the same CPU - the Desktop model. Kill those
huge datasets. Replace those LOCATEs and shift their arguments to be
criteria in WHERE clauses.


regards,
Helen Borrie (TeamIBO Support)

** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com