API:FireDAC.Comp.Client.TFDCommand.CommandText
Delphi
property CommandText;
C++
__property CommandText;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | published | FireDAC.Comp.Client.pas FireDAC.Comp.Client.hpp |
FireDAC.Comp.Client | TFDCommand |
Description
The text of the SQL command to execute.
FireDAC.Comp.Client.TFDCommand.CommandText inherits from FireDAC.Comp.Client.TFDCustomCommand.CommandText. All content below this line refers to FireDAC.Comp.Client.TFDCustomCommand.CommandText.
The text of the SQL command to execute.
The CommandText sets/gets:
- The text of SQL command to execute.
- The name of the stored procedure to execute, if CommandKind is in
[skStoredProc, skStoredProcWithCrs, skStoredProcNoCrs]
.
After setting CommandText, FireDAC will execute the following actions for non-stored procedures:
- Extract the parameters' names and fill the Params collection, if ResourceOptions.ParamCreate is True.
- Extract the macro name and fill the Macros collection, if ResourceOptions.MacroCreate is True.
- Extract the
FROM
table's name forSELECT
commands and assign it to CommandIntf.SourceObjectName, if ResourceOptions.PreprocessCmdText is True. - Fill the value of the CommandKind property, if it is not explicitly set.
If you add a long command, using the CommandText.Add method, then it is recommended to call CommandText.BeginUpdate before the command modification and CommandText.EndUpdate after finishing the command modification.
Later, when Prepare is called, the command text will be preprocessed and transformed into a target DBMS command. See the chapter Preprocessing Command Text for details about FireDAC macros and escape sequences - preprocessor instructions.
See Also
- Preprocessing Command Text
- Executing Commands
- FireDAC.Stan.Option.TFDResourceOptions.ParamCreate
- FireDAC.Stan.Option.TFDResourceOptions.MacroCreate
- FireDAC.Stan.Option.TFDResourceOptions.PreprocessCmdText
- FireDAC.Comp.Client.TFDCustomCommand.CommandKind
- FireDAC.Comp.Client.TFDCustomCommand.Params
- FireDAC.Comp.Client.TFDCustomCommand.Macros
- FireDAC.Comp.Client.TFDCustomCommand.ResourceOptions