EPUB | CHM | PDF

TPSQLDatabase.Methods.Execute

Top Previous Next

Executes an SQL statement.

Syntax:

function Execute(const SQL: String;
                    Params: TParams  = nil;
                     Cache: Boolean  = False;
                    Cursor: phDBICur = nil): Integer;

Parameters:

SQL

SQL is a string value containing the statement to be executed.

Params

Params is a value of type TParams and lists any parameters used by the SQL statement. Use the CreateParam method (TParams) to create one TParams object for each parameter in the SQL statement. Use properties and methods of TParam to configure each TParam and to give each a value prior to calling Execute. If the SQL statement does not include any parameters, pass a nil (Delphi) or NULL (C++) value for Params.

Cache

Cache specifies whether the prepared SQL statement is cached for reuse within the current session. Caching statements can speed their processing if they are used more than once in a session. To clear cached statements just call TPSQLDatabase.Disconnect method.

Cursor

Always nil.

Return values:

Execute returns the number of records affected by executing the SQL statement.

Description:

Use Execute to execute an SQL statement against the database without the overhead of using a TPSQLQuery object.

SQL is a string value containing the statement to be executed.