?
Solved

TQuery.Prepare

Posted on 2001-07-08
9
Medium Priority
?
609 Views
Last Modified: 2008-03-10
What use i prepare. According to the help file, Delphi automatically prepares the query.
0
Comment
Question by:koger
[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
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 9

Expert Comment

by:ITugay
ID: 6262356
Hi koger,

Delphi Help:

Call Prepare to have the BDE and a remote database server allocate resources for the query and to perform additional optimizations. Calling Prepare before executing a query improves application performance.

Delphi automatically prepares a query if it is executed without first being prepared. After execution, Delphi unprepares the query. When a query will be executed a number of times, an application should always explicitly prepare the query to avoid multiple and unnecessary prepares and unprepares.

Preparing a query consumes some database resources, so it is good practice for an application to unprepare a query once it is done using it. The UnPrepare method unprepares a query.

-----
Igor
0
 

Author Comment

by:koger
ID: 6262522
Aha, now I have read it twice
0
 
LVL 9

Expert Comment

by:ITugay
ID: 6262537
:-)
0
Technology Partners: 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!

 

Expert Comment

by:felonious
ID: 6263552
hmm, seems to me (from just reading the help that ITugay so kindly provided) that 'the BDE and a remote database server allocate resources for the query' :)  I guess this is supposed to speed things up.  

I think this is the most unhelpful 'help' I have ever seen in Delphi.. nice.
0
 

Author Comment

by:koger
ID: 6264258
hehe :)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6264363
? prepare is used to reinitialise any allocated memoryplace on server and clientside, specially if parameters are used, there is a need to reallocate the parameters-buffer on both sides.

usefull for sql-server connections, because some statements are failing the automatism provided by delphi and an explicit prepare call, can resolve some mysterious failures on running this statement.

meikl ;-)
0
 

Author Comment

by:koger
ID: 6274906
So normally I would never call prepare ?
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 300 total points
ID: 6275865
>So normally I would never call prepare ?
i need it not often to call prepare
(atleast i needed it only one time to do it
for a complex query with alots parameters)
0
 
LVL 9

Expert Comment

by:ITugay
ID: 6276095
...especcialy if query executed multiply times
------
Igor.
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

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 course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Suggested Courses

719 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