Definitely use TADQuery
. Unless you set the query to Unidirectional
, it will buffer all the records returned from the database in memory (default 50). Since you are dealing with blobs, your query should be written to retrieve the minimum number of records you need.
Use a parameterized query, like the following the query
SELECT * FROM ATable
WHERE X = :X AND Y = :Y AND Z = :Z
Once you have initially opened the query, you can change the parameters, then use the Refresh
method to retrieve the next record.
A memory table could not be used to retrieve data from the database, it would have to be populated via a query. It could be used to replace your TTileCache
records, but I would not recommend it because it would have more overhead than your memory cache implementation.