3.7. TFDCommand component

The TFDCommand component is used to execute SQL queries. It is not descended from TDataSet so it is valid to use only for executing SQL queries that do not return datasets.

Table 5. TFDCommand component main properties
PropertyPurpose

Connection

Reference to the TFDConnection component

Transaction

The transaction within which the SQL command will be executed

CommandKind

Type of command. The types are described in the section below.

CommandText

SQL query text

3.7.1. Types of Command

Usually, the command type is determined automatically from the text of the SQL statement. The following values are available for the property TFDCommand.CommandKind to cater for cases where the internal parser might be unable to make correct, unambiguous assumptions based on the statement text alone:

skUnknown

unknown. Tells the internal parser to determine the command type automatically from its analysis of the text of the command

skStartTransaction

a command for starting a transaction

skCommit

a command for ending and committing a transaction

skRollback

a command for ending and rolling back a transaction

skCreate

a CREATE …​ command for creating a new metadata object

skAlter

an ALTER …​ command for altering a metadata object

skDrop

a DROP …​ command for deleting a metadata object

skSelect

a SELECT command for retrieving data

skSelectForLock

a SELECT …​ WITH LOCK command for locking the selected rows

skInsert

an INSERT …​ command for inserting a new record

skUpdate

an UPDATE …​ command for modifying records

skDelete

a DELETE …​ command for deleting records

skMerge

a MERGE INTO …​ command

skExecute

an EXECUTE PROCEDURE or EXECUTE BLOCK command

skStoredProc

a stored procedure call

skStoredProcNoCrs

a call to a stored procedure that does not return a cursor

skStoredProcWithCrs

a call to a stored procedure that returns a cursor