Craig Stuntz [TeamB] Guest
|
Posted: Thu May 06, 2004 1:40 pm Post subject: Re: using prepare |
|
|
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
|
|