FireDAC.Comp.Client.TFDCustomCommand.Execute
Delphi
procedure Execute(ATimes: Integer = 0; AOffset: Integer = 0; ABlocked: Boolean = False); overload;
function Execute(const ASQL: String): LongInt; overload;
function Execute(const ASQL: String; const AParams: array of Variant): LongInt; overload;
function Execute(const ASQL: String; const AParams: array of Variant; const ATypes: array of TFieldType): LongInt; overload;
C++
void __fastcall Execute(int ATimes = 0x0, int AOffset = 0x0, bool ABlocked = false)/* overload */;
int __fastcall Execute(const System::UnicodeString ASQL)/* overload */;
int __fastcall Execute(const System::UnicodeString ASQL, const System::Variant *AParams, const int AParams_High)/* overload */;
int __fastcall Execute(const System::UnicodeString ASQL, const System::Variant *AParams, const int AParams_High, const Data::Db::TFieldType *ATypes, const int ATypes_High)/* overload */;
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
public | FireDAC.Comp.Client.pas FireDAC.Comp.Client.hpp |
FireDAC.Comp.Client | TFDCustomCommand |
Description
Executes the SQL command.
The Execute method is overloaded:
- The first overloaded method executes the SQL command specified by the CommandText, which does not return result sets. If the command returns result sets, then all of them will be discarded. The command may be executed in one of the following modes:
Mode |
Parameter values |
Meaning |
---|---|---|
Standard or default. The SQL command is executed only one time. |
|
The number of rows affected by the SQL command (inserted, updated, deleted, etc). This information is provided by DBMS and is not "reviewed" by FireDAC. |
Array DML. |
|
The number of successful command executions for each of the parameter array items. For a detailed description, see Array DML. |
- The second overloaded method executes the SQL command specified by the
ASQL
parameter, which does not return result sets. If the command returns result sets, then all of them will be discarded. - The third overloaded method executes the parameterized SQL command specified by the
ASQL
parameter, which does not return result sets. If the command returns result sets, then all of them will be discarded. TheAParams
parameter represents the open array of parameter values that will be assigned in order of occurences in the text of the SQL command. - The fourth overloaded method executes the parameterized SQL command specified by the
ASQL
parameter, which does not return result sets. If the command returns result sets, then all of them will be discarded. The method requires to specify the parameter data types. TheAParams
parameter represents the open array of parameter values that will be assigned in order of occurences in the text of the SQL command. TheATypes
parameter represents an open array of parameter data types.
Example
//First overloaded method
ADCommand1.CommandText.Text := 'create table MyTab (f1 number, f2 varchar2(10))';
ADCommand1.Execute;
//Second overloaded method
ADCommand1.Execute('DROP TABLE MyTab');
//Third overloaded method
ADCommand1.Execute('delete from MyTab where id = : id', [100]);\
//Fourth overloaded method
ADCommand1.Execute('insert into MyTab (id, bval) values (:id, :bval)', [100, StringOfChar('x', 100000)], [ftInteger, ftBLOB]);