[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'SQLDB' (#fcl)

TCustomSQLStatement

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Object to execute SQL statements without result set.

Declaration

Source position: sqldb.pp line 359

type TCustomSQLStatement = class(TComponent)

public

  constructor Create(); override;

  

Create a new instance of TCustomSQLStatement

  destructor Destroy; override;

  

Destroy a TCustomSQLStatement instance.

  procedure Prepare;

  

Prepare the statement for execution

  procedure Execute;

  

Execute the SQL statement.

  procedure Unprepare;

  

Unprepare a previously prepared statement

  function ParamByName();

  

Find a parameter by name

  function RowsAffected; virtual;

  

Number of rows affected by the SQL statement.

  property Prepared: Boolean; [r]

  

Is the statement prepared or not

end;

Inheritance

TCustomSQLStatement

  

Object to execute SQL statements without result set.

|

TComponent,IUnknown,IInterfaceComponentReference

|

TPersistent,IFPObserved

|

TObject

Description

TCustomSQLStatement is a light-weight object that can be used to execute SQL statements on a database. It does not support result sets, and has none of the methods that a TDataset component has. It can be used to execute SQL statements on a database that update data, execute stored procedures and DDL statements etc.

The TCustomSQLStatement is equivalent to TSQLQuery in that it supports transactions (in the Transaction property) and parameters (in the Params property) and as such is a more versatile tool than executing queries using TSQLConnection.ExecuteDirect.

To use a TCustomSQLStatement is simple and similar to the use of TSQLQuery: set the Database property to an existing connection component, and set the Transaction property. After setting the SQL property and filling Params, the SQL statement can be executed with the Execute method.

TCustomSQLStatement is a parent class. Many of the properties are only made public (or published) in the TSQLStatement class, which should be instantiated instead of the TCustomSQLStatement class.

See also

TSQLStatement

  

Class to execute non-select SQL statements.

TDataset

TSQLQuery

  

Class to handle SQL commands (with or without result set)

TSQLStatement.Transaction

  

The transaction in which the SQL statement should be executed.

TSQLStatement.Params

  

List of parameters.

Execute

TSQLStatement.Database

  

Database instance to execute statement on.

TSQLConnection.ExecuteDirect

  

Execute a piece of SQL code directly, using a Transaction if specified


Documentation generated on: Jun 22 2020