FireDAC.Stan.Param.TFDMacro
Delphi
TFDMacro = class(TCollectionItem)
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
class | public | FireDAC.Stan.Param.pas | FireDAC.Stan.Param | FireDAC.Stan.Param |
Description
Represents a substitution variable for a query part.
Use the TFDMacro class when you want to parameterize the query parts, where impossible to use parameters. This may be a lexical element different from a literal value, for example, a table name in a FROM clause. A substitution variable and macro are synonyms in the context of FireDAC.
A substitution variable starts with the ! or & symbol and is followed by the macro name. The symbols have the following meaning:
- ! - "string" substitution mode. The macro value will be substituted “as is”, directly into the command text, without any transformation.
- & - "SQL" substitution mode. The macro value will be substituted depending on the macro data type, using the target DBMS syntax rules.
Example
// &Tab_name represents a macro. FDQuery1.SQL.Text := 'SELECT * FROM &Tab_name'; FDQuery1.MacroByName('Tab_name').AsIdentifier := 'Order Details'; FDQuery1.Open;