UniDAC

TVirtualQuery Class

Used to retrieve data simultaneously from various RDBMS'es.

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

Unit

VirtualQuery

Syntax

TVirtualQuery = class(TCustomVirtualQuery);

Remarks

TVirtualQuery component is used to retrieve data simultaneously from several different RDBMS'es. Instead of a database connection, it use a collection of TDataSet descendants defined in the TCustomVirtualQuery.SourceDataSets property as the data source, for which a SQL statement can be build. The SQLite is used as an internal SQL-engine, so the SQLite syntax has to be used for SQL statements.

Use TVirtualQuery to perform fetching, insertion, deletion and update of record by dynamically generated SQL statements. 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, TVirtualQuery will retrieve primary keys for UpdatingTable from metadata. TVirtualQuery 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
      TCustomVirtualQuery
         TVirtualQuery

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