koger
asked on
TQuery.Prepare
What use i prepare. According to the help file, Delphi automatically prepares the query.
ASKER
Aha, now I have read it twice
:-)
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.
I think this is the most unhelpful 'help' I have ever seen in Delphi.. nice.
ASKER
hehe :)
? 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 ;-)
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 ;-)
ASKER
So normally I would never call prepare ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
...especcialy if query executed multiply times
------
Igor.
------
Igor.
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