Solved

TQuery.Prepare

Posted on 2001-07-08
9
598 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
  • 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

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 Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

825 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