EPUB | CHM | PDF

TMySQLDatabase.Methods.Execute

Top Previous Next

Executes an SQL statement.

Syntax:

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

Description:

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

SQL

A String value containing the statement to be executed.

Params

A value of type TParams and lists any parameters used by the SQL statement. Parameter binding is by index only (not by name), so the order of parameters is important and the order of the TParam objects in Params corresponds to the order of the parameters in the SQL statement. Use properties and methods of TParams to create a TParams object and add one TParam object for each parameter. Use properties and methods of TParam like the AsString property to give each parameter a value prior to calling Execute. If the SQL statement does not include any parameters, pass a nil value for Params.

Cache

Specifies whether the prepared SQL statement is cached for reuse within the current transaction. Caching statements can speed their processing if they are used more than once in a transaction.

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

note Execute doesn't open or stores any resultsets returned by query. All resultsets are ignored.

See also: SelectXXX methods group