[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
Prepare a query for execution.
Source position: sqldb.pp line 558
public procedure TCustomSQLQuery.Prepare; virtual; |
Prepare will prepare the SQL for execution. It will open the database connection if it was not yet open, and will start a transaction if none was started yet. It will then determine the statement type. Finally, it will pass the statement on to the database engine if it supports preparing of queries.
Strictly speaking, it is not necessary to call prepare, the component will prepare the statement whenever it is necessary. If a query will be executed repeatedly, it is good practice to prepare it once before starting to execute it. This will speed up execution, since resources must be allocated only once.
If the SQL server cannot prepare the statement, an exception will be raised.
|
SQL statement type |
|
|
Unprepare a prepared query |
|
|
Execute a SQL statement that does not return a result set |