[fpc-pascal] TBufDataset vs TClientDataset

Michael Van Canneyt michael at freepascal.org
Mon Oct 9 10:08:12 CEST 2017

On Sun, 8 Oct 2017, Graeme Geldenhuys wrote:

> Hi,
> I read a couple of archived mailing list posts about TBufDataset, which 
> from what I read is FPC's equivalent to TClientDataset.

Equivalent in that it does many things that TClientDataset does.

> That then begs the question... Why isn't it called TClientDataset in 
> FPC? What happened to Delphi-compatibility?

Because it was never meant to be a TClientDataset equivalent, but it has
grown into something that does many of the things TClientDataset does.

Naming it TClientDataset would imply that we ensure TClientDataset
compatibility, which definitely was/is not the case.

Some history:
The buffer management in TDataset descendents can be daunting. 
The idea was to create TBufDataset (hence the name: it manages buffers) 
which would make buffer management easier for possible descendents, 
in particular: TSQLQuery from SQLDB. This explains the name: TBufDataset.

When developing TSQLQuery, many features were added (local indexes for
sorting, local filters), which logically belonged in TBufdataset. 
So they were implemented in TBufDataset.

Finally, we ended up with a TDataset descendent that implements lots of the
functionality of TClientDataset, but which is not compatible in other areas.

So if someone wants to 'complete' TClientdataset, he has most of his work
cut out for him: descend from TBufDataset and add some missing features.

> Also, what's the difference between TBufDataset and TMemDataset? Aren't 
> they both in-memory datasets? If so, why do we have two different 
> components for the same thing?

Historic reasons. It existed before TBufDataset. 
Rewriting TMemdataset so it sits on top of TBufDataset is since long on 
my TODO list, a list which meanwhile risks to collapse under its own 
weight and turn into a black hole...

If anyone is interested in tackling these problems (implement TClientDataset,
TMemDataset rebase): feel free. It may help to avoid us all getting sucked
into the black hole.


More information about the fpc-pascal mailing list