BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

using prepare

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Rafel Coyle
Guest





PostPosted: Wed May 05, 2004 9:59 pm    Post subject: using prepare Reply with quote



Where can I find information how to make more efficient use of query
componenets via the prepared property? I can't figure out if once a
tquery is executed if the prepared property is set to true automatically
or should I set it to true. I also would like to find out when I should
set it back to false.

Back to top
Craig Stuntz [TeamB]
Guest





PostPosted: Thu May 06, 2004 1:40 pm    Post subject: Re: using prepare Reply with quote



Rafel Coyle wrote:

Quote:
Where can I find information how to make more efficient use of query
componenets via the prepared property?

In the BDE, you want to explicitly prepare a query whenever you will
be executing the same query more than once. Usually, this is because
the query is parameterized and you'll be executing the query multiple
times with different param values. A good example is a detail query in
a master-detail link.

Quote:
I can't figure out if once a
tquery is executed if the prepared property is set to true
automatically or should I set it to true.

This code will work:

if not MyQuery.Prepared then begin
MyQuery.Prepare;
end;

Quote:
I also would like to find
out when I should set it back to false.

Never. Contrary to the documentation, the BDE will automatically
unprepare queries when required, so there is never a need to do this.

Note also that explicit prepares are not necessary with IBX, as they
are done automatically.

-Craig

--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : http://delphi.weblogs.com
InterBase PLANalyzer 1.1 -- Free InterBase query optimization
tool: http://delphi.weblogs.com/IBPLANalyzer

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.