[fpc-devel] About TDataSet master/detail design in fpc
Michael Van Canneyt
michael at freepascal.org
Fri May 6 21:14:57 CEST 2005
On Fri, 6 May 2005, Uberto Barbini wrote:
> > They are not yet implemented. But NestedDataset and DatasetField are
> > ONLY for TClientDataset, and we don't support TClientDataset (yet).
>
> Not only, they were first implemented for Oracle object field and they're used
> by some other custom implementation, for example InstantObject exposers use
> them for accessing parts (subobjects).
Then how does TDataset know how to load itself from a TDatasetField ?
There is no code in DB.Pas to do this.
In TClientDataset, it's just a blob with a complete data package in it,
but the definition of this packages only makes sense to another TClientDataset.
TDatasetProvider has a mechanism to pack a 'traditional' Master/Detail dataset
(e.g. using TQuery) into a TClientDataset packet for the Master with a
TDatasetField containing the data from the detail dataset...
A horrible mechanism, but it works more or less.
> I began to rewrite something similar for fpc some week ago, I hope to continue
> soon.
>
> > > I'd be glad if someone could explain how the design works and what is
> > > expected from a TDataset descendant that support it.
> >
> > Nothing is expected, i.e. TDataset does not implement anything
> > concerning master/detail. How could it ?
>
> Not yet that is.
> With NestedDataset in Delphi you could.
Yes, but TNestedDataset is a BDE implementation.
It uses a proprietary format.
The bottom line is that at the TDataset level, there exists only TDatasetField.
You need to create a descendent of TDataset to access the data in a TDatasetField,
and TClientDataset or TNestedDataset are standard Delphi TDatasets which do this.
Michael.
More information about the fpc-devel
mailing list