LiteDAC

TLiteQuery Class

A component for executing queries and operating record sets. It also provides flexible way to update data.

For a list of all members of this type, see TLiteQuery members.

Unit

LiteAccess

Syntax

TLiteQuery = class(TCustomLiteDataSet);

Remarks

TLiteQuery is a direct descendant of the TCustomLiteDataSet component. It publishes most of its inherited properties and events so that they can be manipulated at design-time.

Use TLiteQuery to perform fetching, insertion, deletion and update of record by dynamically generated SQL statements. TLiteQuery provides automatic blocking of records, their checking before edit and refreshing after post. Set SQL, SQLInsert, SQLDelete, SQLRefresh, and SQLUpdate properties to define SQL statements for subsequent accesses to the database server. There is no restriction to their syntax, so any SQL statement is allowed. Usually you need to use INSERT, DELETE, and UPDATE statements but you also may use stored procedures in more diverse cases.

To modify records, you can specify KeyFields. If they are not specified, TLiteQuery will retrieve primary keys for UpdatingTable from metadata. TLiteQuery can automatically update only one table. Updating table is defined by the UpdatingTable property if this property is set. Otherwise, the table a field of which is the first field in the field list in the SELECT clause is used as an updating table.

The SQLInsert, SQLDelete, SQLUpdate, SQLRefresh properties support automatic binding of parameters which have identical names to fields captions. To retrieve the value of a field as it was before the operation use the field name with the 'OLD_' prefix. This is especially useful when doing field comparisons in the WHERE clause of the statement. Use the TLiteQuery.BeforeUpdateExecute event to assign the value to additional parameters and the TLiteQuery.AfterUpdateExecute event to read them.

Inheritance Hierarchy

TMemDataSet
   TCustomDADataSet
      TCustomLiteDataSet
         TLiteQuery

See Also

© 1997-2024 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback