Wednesday, May 13, 2009

Creating and using a client dataset

TClientDataSet is a dataset component designed to work without the connectivity support of the Borland Database Engine (BDE) or ActiveX Data Objects (ADO). Instead, it uses MIDAS.DLL, which is much smaller and simpler to install and configure. You don’t use database or ADO connection components with client datasets, because there is no database connection.
Client datasets provide all the data access, editing, navigation, data constraint, and filtering support introduced by TDataSet. However, the application that uses a client dataset must provide the mechanism by which the client dataset reads data and writes updates. Client datasets provide for this in one of the following ways:

Reading from and writing to a flat file accessed directly from a client dataset component. This is the mechanism used by flat-file database applications.
-Reading from another dataset. Client datasets provide a variety of mechanisms for copying data from other datasets. These are described in Copying data from another dataset.
-Using an IAppServer interface to obtain data from and post updates to a remote application server. This is the mechanism used by clients in a multi-tiered database application.

These mechanisms can be combined into a single application that employs the “briefcase model”. Users take a snapshot of data, saving it to a flat-file so that they can work on it off-line. Later, the client application applies the changes from the local copy of data to the application server. The application server resolves them with the actual database, and returns errors to the client dataset for handling

TClientDataSet
TClientDataSet implements a database-independent dataset.
Unit
dbclient

Description

TClientDataSet encapsulates a database-independent, distributed dataset. A client dataset can be used as a

-Fully-functional, standalone, flat-file dataset for single-tiered database applications. When used in this manner, an application uses the client dataset to read from and write to a user’s hard disk directly, without accessing a database engine.
-Client dataset in the client application portion of a multi-tiered database application.

NB:The two functions described above are not mutually exclusive. A multi-tiered application can be designed to support the option of working with data off-line, using the “briefcase” model. On site, the application uses TClientDataSet to communicate with the application server’s data provider. When a user works off site, the client dataset writes a snapshot of the data to the hard disk. The application works with this snapshot off site, with the client dataset acting as a flat-file dataset in a single-tiered application.

The client dataset can communicate with a data provider directly by calling the provider component’s methods. When used in a client application as part of a multi-tiered application, the client dataset passes all calls to the provider through the remote data module’s IAppServer interface.

No comments:

Post a Comment