?
Solved

problem with locate method

Posted on 2002-05-02
5
Medium Priority
?
965 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 140 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 140 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

764 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