Client Dataset: Working with Data Packets and Applying Updates - Information in Data Packets
(Page 3 of 4 )
Working with information in data packets
TClientDataset/TDataset Provider components offer a number of ways to control data packets that are being transacted.
Using the Options property of the Dataset Provider
The Dataset Provider's Options property lets you specify a number of conditions that can be imposed when transacting data. To specify these conditions during design time, you can access these properties in the Object Inspector by expanding the Options property of TDataset Provider. To control what data manipulation operations are on the server, you can use the following options: poDisableEdits, poDisableInserts, or poDisableDeletes.
Setting poDisableEdits to true ensures that no existing record is modified, but it does not restrict the user from inserting a new record or deleting an existing one. poDisableInserts prevents the user from inserting a new record but it allows the user to edit or delete existing records, if the poDisableEdit and poDisableDeletes options are set to false. Finally, poDisableDeletes prevents the user from deleting records, but does not restrict the user from inserting or editing it. If you want to prevent any change to the data set the poReadOnly property to true.
The client dataset stores data locally, which also implies that it will always exert pressure on system resources. For this reason the client dataset does not retrieve some data, like BLOB data, by default; instead it requests it and retrieves it automatically when the need arises. Alternatively, you can also call the FetchBlobs method to load BLOB data to the dataset. However, it requires that the provider's poFetchBlobOnDemand option and the client dataset's FetchOnDemand property be set to true.
As with BLOB data, data in the details tables of a master/detail relationship are not retrieved by default. Rather, they are retrieved only when they are needed or by using the client dataset's FetchDetails method. To enable the retrieval of records from the details table, ensure that the poFetchDetailsOnDemand property is set to true. Apart from this there are two more options that assume significance when working with the dataset representing the master/detail relationship.
poCascadeDeletes : This option provides that when a master record is deleted, the corresponding values in detail tables are deleted too.
poCascadeUpdates: If this option is enabled, values in the details tables are updated automatically when the master record is updated.
You also need to set the poAllowCommandText property to true, if you want to retrieve specific sets of records using SQL, table name or stored procedure. If this property is enabled the command text is sent to the server and records returned are sent back to the client dataset. But if this property is set to false, the CommandText property of the client dataset has no impact and the associated dataset is used as the data source.
Besides these, there are many other properties of the DatasetProvider's Option property. Refer to Delphi documentation for a complete list and descriptions.

I should mention here that if you want to apply changes to the source dataset (make sure the dataset is not read-only), you can set the Dataset Provider's ResolveToDataSet property to true.
Next: Specific Fields and Custom Information >>
More Delphi-Kylix Articles
More By Danish Ahmed