FireDAC.Comp.Client.TFDCustomCommand.Prepare
Delphi
procedure Prepare(const ACommandText: String = '');
C++
void __fastcall Prepare(const System::UnicodeString ACommandText = System::UnicodeString());
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
public | FireDAC.Comp.Client.pas FireDAC.Comp.Client.hpp |
FireDAC.Comp.Client | TFDCustomCommand |
Description
Prepares the SQL command for execution.
Call the Prepare method to prepare the SQL command for execution. After that, the value of State becomes csPrepared
. It is not required to call Prepare for a standard SQL command before execution, because the first Execute / Open automatically prepares the command. Instead, it is required for the stored procedures, if you need to automatically populate the Params collection. After the command is prepared, SQLText returns the SQL command's text as it is sent to the DBMS.
To prepare the SQL command, the DBMS connection must be active, otherwise an exception is raised.
After preparing, the call of the application cannot change the command parameter's data types and sizes, otherwise at the next Execute or Open call an exception is raised.
Note: Setup the parameters before calling Prepare.
Example
ADCommand1.Prepare('select * from MyTab');