Solved

problem with locate method

Posted on 2002-05-02
5
960 Views
Last Modified: 2012-06-21
Hello.
I'm having memory problems when using the locate method. I'm using an
IBTable(Interbase). I've also tried with IBDataSet. The problem is the same.
The strange thing is that it depends on the tables I use...
When I do the following code:

FrmDados.Tabela_Amostra.active:=TRUE;
existe:=FrmDados.Tabela_Amostra.locate('chave_carta_fk;num_amostra',VarArray
Of([car.chave_carta,namo]),[]);

the memory allocated increases a lot (sometimes 3 times more; I'm checking
the memory with GetHeapStatus.TotalAllocated).
But when I run this code:

FrmDados.Tabela_Pesagem.active:=TRUE;
existe:=FrmDados.Tabela_pesagem.locate('chave_amostra_fk;n',VarArrayOf([chav
e_a,pes.N]),[]);

the memory sometimes decreases!!!! The tables are not the same, but the
second table has more records than the first!
Can anyone give me some tips on how to avoid this memory problem?
Thanks

Goncalo

0
Comment
Question by:gmartins77
5 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 35 total points
ID: 6986908
o yes,
use a query and a whereclause

meikl ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6986946
if you do not want a query,
then supply the table with indexes on the to locate fields

meikl ;-)
0
 
LVL 3

Expert Comment

by:VSF
ID: 6988377
A locate should be that last thing to be used in order not to increase the memory usage!
U should also take a look at IBSQL component in order to execute a query with a minimum overhead!

Espero q tenha ajudado! (Vi o português no nome das suas tabelas).

VSF
www.victory.hpg.com.br
www.boatoda.hpg.com.br
www.enge.cjb.net
 
0
 
LVL 2

Assisted Solution

by:dMa
dMa earned 35 total points
ID: 6988832
please use a Query and use anytime an index in your tables ! ... idexes are everytime very usefull :)

sample for an query :
SELECT * FROM (tablename) WHERE (FIELDNAME)=:PARAM

in your params you have to declare an parameter names PARAM

in code :
query.params('PARAM').As(Integer , string ,blob) := (you variable) ;
query.execute;

thet's all :)
0
 
LVL 1

Expert Comment

by:pnh73
ID: 9004510
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split between kretzschmar and dMa

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question