UniDAC

TUniQuery 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 TUniQuery members.

Unit

Uni

Syntax

TUniQuery = class(TCustomUniDataSet);

Remarks

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

Use TUniQuery to perform fetching, insertion, deletion and update of record by dynamically generated SQL statements. TUniQuery 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, TUniQuery will retrieve primary keys for UpdatingTable from metadata. TUniQuery 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 TCustomDADataSet.BeforeUpdateExecute event to assign the value to additional parameters and the TCustomDADataSet.AfterUpdateExecute event to read them.

Inheritance Hierarchy

TMemDataSet
   TCustomDADataSet
      TCustomUniDataSet
         TUniQuery

See Also

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