Previous Topic

Next Topic

Inhoudsopgave

Book Index

TIsahQuery Component

TIsahQuery

Description

TIsahQuery represents a unidirectional dataset with a result set that is based on a SQL statement. Unidirectional datasets are designed for quick lightweight access to database information, with minimal overhead. They can send an SQL command to the database server, and if the command returns a set of records, obtain a cursor for accessing those records. However, unidirectional datasets can only retrieve a unidirectional cursor. They do not buffer data in memory, which makes them faster and less resource-intensive than other types of datasets. However, because there are no buffered records, unidirectional datasets are also less flexible than other datasets. Many of the capabilities introduced by TDataSet are either unimplemented in unidirectional datasets, or cause them to raise exceptions. For example:

The only supported navigation methods are the First and Next methods. Most others raise exceptions. Some, such as the methods involved in bookmark support, simply do nothing.

There is no built-in support for editing because editing requires a buffer to hold the edits. The CanModify property is always False, so attempts to put the dataset into edit mode always fail. You can, however, use unidirectional datasets to update data using an SQL UPDATE command or provide conventional editing support by connecting the dataset to a client dataset.

There is no support for filters, because filters work with multiple records, which requires buffering. If you try to filter a unidirectional dataset, it raises an exception. Instead, all limits on what data appears must be imposed using the SQL command that defines the data for the dataset.

There is no support for lookup fields, which require buffering to hold multiple records containing lookup values. If you define a lookup field on a unidirectional dataset, it does not work properly.

Details

Use TIsahQuery to access one or more tables in a database using SQL statements.

Query components are useful because they can:

TIsahQuery Properties

Property Property Active: Boolean (R/W)

Specifies whether or not a dataset is open. Use Active to determine or set whether a dataset is populated with data. When Active is false, the dataset is closed; the dataset cannot read data and data-aware controls can not use it to fetch data. When Active is true, the dataset can be populated with data.

Property Property DatabaseName: String (R/W)

Specifies the name of the database associated with this dataset. Use DatabaseName to specify the name of the database to associate with this dataset component. DatabaseName should match the name of a database component used in the application.

Note: Attempting to set DatabaseName in case a database already associated with this component is open, will cause an exception.

Property Property Params: Params list (R)

Contains the parameters for a query's SQL statement. Access Params at runtime to view and set parameter names, values, and data types dynamically (at design time use the collection editor for the Params property to set parameter information). Params is a zero-based array of TParams parameter records. Index specifies the array element you want to access.

Property Property SQL: TStringList object (R)

Contains the text of the SQL statement you want to execute. Use SQL to provide the SQL statement that a query component executes when its ExecSQL or Open method is called. At design time the SQL property can be edited by calling the String List editor in the Object Inspector. The SQL property can contain only one complete SQL statement at a time.