RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TIBQuery.Prepare Method

Sends a query to the server for optimization prior to execution.

Pascal
procedure Prepare;
C++
__fastcall Prepare();

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

A query is automatically prepared before being executed. A query that was automatically prepared will then be automatically unprepared after it executes. 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.

Note: When you change the text of a query at runtime, the query is automatically closed and unprepared.
 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!