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 TOraQuery members.
TOraQuery = class(TCustomOraQuery);
TOraQuery is a direct descendant of the TOraDataSet component. It publishes most of its inherited properties and events so that they can be manipulated at design-time.
Use TOraQuery to perform fetching, insertion, deletion and update of record by dynamically generated SQL statements. TOraQuery 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 of TOraQuery SELECT statement in SQL, property should retrieve ROWID of updating table. To modify records, you can specify KeyFields. If they are not specified, TOraQuery will retrieve primary keys for UpdatingTable from metadata. TOraQuery 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.
TOraQuery performs read-only access if none of SQLInsert, SQLDelete, SQLUpdate properties is defined.