FireDAC.Comp.Client.TFDCustomConnection.ExecSQL
Delphi
function ExecSQL(const ASQL: String; AIgnoreObjNotExists: Boolean = False): LongInt; overload;
function ExecSQL(const ASQL: String; const AParams: array of Variant): LongInt; overload;
function ExecSQL(const ASQL: String; const AParams: array of Variant;
const ATypes: array of TFieldType): LongInt; overload;
function ExecSQL(const ASQL: String; AParams: TFDParams): LongInt; overload;
function ExecSQL(const ASQL: String; AParams: TFDParams; var AResultSet: TDataSet): LongInt; overload;
function ExecSQL(const ASQL: String; var AResultSet: TDataSet): LongInt; overload;
C++
int __fastcall ExecSQL(const System::UnicodeString ASQL, bool AIgnoreObjNotExists = false)/* overload */;
int __fastcall ExecSQL(const System::UnicodeString ASQL, const System::Variant *AParams, const int AParams_High)/* overload */;
int __fastcall ExecSQL(const System::UnicodeString ASQL, const System::Variant *AParams, const int AParams_High, const Data::Db::TFieldType *ATypes, const int ATypes_High)/* overload */;
int __fastcall ExecSQL(const System::UnicodeString ASQL, Firedac::Stan::Param::TFDParams* AParams)/* overload */;
int __fastcall ExecSQL(const System::UnicodeString ASQL, Firedac::Stan::Param::TFDParams* AParams, Data::Db::TDataSet* &AResultSet)/* overload */;
int __fastcall ExecSQL(const System::UnicodeString ASQL, Data::Db::TDataSet* &AResultSet)/* overload */;
Inhaltsverzeichnis
Eigenschaften
| Typ | Sichtbarkeit | Quelle | Unit | Übergeordnet |
|---|---|---|---|---|
| function | public | FireDAC.Comp.Client.pas FireDAC.Comp.Client.hpp |
FireDAC.Comp.Client | TFDCustomConnection |
Beschreibung
Führt eine SQL-Anweisung aus und gibt die Anzahl der betroffenen Zeilen zurück.
ExecSQL akzeptiert bestimmte Kombinationen der folgenden Parameter:
ASQList ein String, der die auszuführende SQL-Anweisung enthält.AResultSetist eine Instanz von TDataSet, die ExecSQL mit den Daten füllt, die das Datenbankmanagementsystem als Antwort auf Ihre SQL-Anweisung zurückgibt.AParamsist entweder ein Varianten-Array oder eine Instanz von TFDParams, die einen oder mehrere Parameter zum Füllen der SQL-Anweisung angibt.ATypesist ein Feldtypen-Array, das die Typen der angegebenen Parameter festlegt. Verwenden SieftUnknown, wenn Sie den Typ eines bestimmten Parameters nicht angeben möchten.AIgnoreObjNotExistslegt fest, ob ExecSQL Exceptions der Art "Objekt ist nicht vorhanden" ignorieren (verbergen) muss (True) oder nicht (False). Diese Methode ist beispielsweise dann hilfreich, wenn SieDROP-Anweisungen für Datenbankmanagementsysteme ausführen, die die SyntaxDROP IF EXISTSnicht unterstützen. Signaturen, für die Sie keinen Wert fürAIgnoreObjNotExistsangeben können, geben alle Exceptions weiter.
Beispiel
FDConnection1.ExecSQL('truncate table tab1');
FDConnection1.ExecSQL('drop table tab2', True);
FDConnection1.ExecSQL('delete from mytab where id > :p1', [1000]);
FDConnection1.ExecSQL('update mytab where id = :p1 set blobfld = :blb',
[1000, StringOfChar('x', 100000)], [ftInteger, ftBLOB]);