Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2017-10

TBufDataset vs TClientDataset

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

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

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

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?

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp
Marcos Douglas B. Santos
to Graeme Geldenhuys
Graeme Geldenhuys wrote 7 lines
Hi, I read a couple of archived mailing list posts about TBufDataset, which from what I read is FPC's equivalent to TClientDataset. That then begs the question... Why isn't it called TClientDataset in FPC? What happened to Delphi-compatibility?

Good question...

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?

Yes, they are both in-memory datasets and, I believe, TMemDataSet came first and TBufDataSet could be an improvement. Here -> http://wiki.freepascal.org/How_to_write_in-memory_database_applications_in_Lazarus/FPC says that TBufDataSet is a better choice.

Why two classes for the same thing? I have no idea.

More interesting links:
- http://lazarus.lazarus.freepascal.narkive.com/Fe8TZqtR/tbufdataset-tmemdataset-and-a-big-headache
- http://forum.lazarus.freepascal.org/index.php?topic=30454.0

Regards,
Marcos Douglas

Michael Van Canneyt
to Graeme Geldenhuys: I read a couple of archived mailing list posts about TBufDataset, which from what I read…
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.

Michael.

Graeme Geldenhuys
to Michael Van Canneyt
Michael Van Canneyt wrote 5 lines
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.

OK, that's understandable. Thanks for the background information.

Historic reasons. It existed before TBufDataset. Rewriting TMemdataset so it sits on top of TBufDataset is since long on

So it is recommended to use TBufDataset over TMemDataset?

If anyone is interested in tackling these problems (implement TClientDataset, TMemDataset rebase)

Ah, I see Git is growing on you [using git terminology there]. ;-)

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp
Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 14 lines
On 2017-10-09 09:08, Michael Van Canneyt wrote: > 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. OK, that's understandable. Thanks for the background information. > Historic reasons. It existed before TBufDataset. > Rewriting TMemdataset so it sits on top of TBufDataset is since long on So it is recommended to use TBufDataset over TMemDataset?

Yes, absolutely.

Show quoted text 7 lines
> If anyone is interested in tackling these problems (implement TClientDataset, > TMemDataset rebase) Ah, I see Git is growing on you [using git terminology there]. ;-)

It definitely has a way of crawling under your skin... ;)

Michael.

Graeme Geldenhuys
to Michael Van Canneyt
Michael Van Canneyt wrote
> So it is recommended to use TBufDataset over TMemDataset? Yes, absolutely.

Thanks.

> Ah, I see Git is growing on you [using git terminology there].;-) It definitely has a way of crawling under your skin...;)

Resistance is futile. :-)

Regards,
Graeme

LacaK
to Graeme Geldenhuys: I read a couple of archived mailing list posts about TBufDataset, which from what I read…
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?

As Michael wrote TMemDataSet is older.

And I add that it is also much "lighter". So for somebody who does not need "complexity" of TBufDataset there is IMO still space for TMemDataSet. (IMO there is no need to emulate TMemDataSet by TBufDataSet ... there is TBufDataset a long time and everybody who needs his functionality can switch to TBufDataset without much effort)

There may be confusing with naming and purpose, but this can be easily solved by adding 1-2 sentences to documentation ... I added one sentence to: http://wiki.freepascal.org/TMemDataset

-Laco.