Solved

TQuery.Prepare

Posted on 2001-07-08
9
600 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 100 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

730 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