[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'sqldb' (#fcl)

TCustomSQLQuery.Prepare

Prepare a query for execution.

Declaration

Source position: sqldb.pp line 511

public procedure TCustomSQLQuery.Prepare; virtual;

Description

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.

Errors

If the SQL server cannot prepare the statement, an exception will be raised.

See also

TSQLQuery.StatementType

  

SQL statement type

TCustomSQLQuery.UnPrepare

  

Unprepare a prepared query

TCustomSQLQuery.ExecSQL

  

Execute a SQL statement that does not return a result set


Documentation generated on: Nov 14 2015