Filtering of data on server, bookmarking of nested datasets, ApplyUpdates events, etc.


2006-12-19 08:50:50 PM
delphi13
Hi,
I hope I am not infringing rules of newsgroup etiquette by asking too many
questions, but I have a few more queries regarding the functioning of
dbExpress! it is a complex subject, that currently available Delphi books
don't seem to cover in sufficient detail to furnish a good understanding.
Can anyone help with any of these questions?
1. The dataset returned by a TSQLDataset may be varied at run-time by
introducing one or more parameters into the WHERE clause of the
TSQLDataset.CommandText property. However to provide even greater
flexibility, it would be desirable to be able to specify a filter
expression that may be defined at run-time, which would result in only those
records that satisfy the filter expression being returned in the
TSQLDataset. it is not clear to me from the on-line help for TDataset.Filter
property whether this is possible. The help refers to 'Filter expressions on
remote SQL tables', which seems to suggest that it is possible, but goes on
to note: 'Filters are not supported on unidirectional datasets. If you set
the Filter property of a unidirectional dataset, it raises an exception.'
How actually does the Filter property work for TSQLDatasets?
2 it is not clear to me if there are any differences in behaviour between the
Open and Refresh methods of a TClientDataset component connected through a
TDatsetProvider to a SQLDataset. They both seem to repopulate the client
dataset by re-executing the SQL command on the database. What are the
differences, if any?
3. If a client dataset contains nested datasets (to any number of levels),
does calling the Bookmark function on the the top level dataset cause the
locations of the cursors in the nested datasets to be recorded as well as
that the location of the cursor in the top-level dataset?
4. If it is required to say timestamp a modified clientdataset record when
its updates are applied to the database server, without using a trigger
procedure on the server, it would seem possible to do so in a
BeforeUpdateRecord event handler of the DatasetProvider. Is that correct?
Is the BeforeUpdateRecord event handler executed within the same transaction
in which the record updates are applied, in accordance with the following
logic:?
for each modified record in Changelog do
begin
start a transaction
try
execute BeforeUpdateRecord event handler if assigned
apply record updates to database
commit transaction
except
Roll back transaction
end
end
5. In a briefcase model scenario, can TClientDataset.SaveToFile be called
repeatedly so that all the client datasets in a data module be written
sequentailly to a single local file? When a CDS containing nested datasets
is saved to file, do all the nested datasets (to all levels of nesting) get
automatically saved to file, and does the reverse happen when it is loaded
from file?
Regards,
Enquiring Mind