[fpc-devel] Implementing a Dataset

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Mon Sep 3 14:15:47 CEST 2012



On Mon, 3 Sep 2012, Felipe Monteiro de Carvalho wrote:

> On Mon, Sep 3, 2012 at 11:18 AM,  <michael.vancanneyt at wisa.be> wrote:
>> I think your best bet is to create a descendent of TBufDataset: it is in
>> itself a full TDataset.
>>
>> You'll have to implement the least amount of methods there, and you can see
>> in TSQLQuery which ones.
>
> But why would this be a better solution? TBufDataset is huge ... it me
> it looks much harder to understand how it works and subclass it then
> to attempt to start with empty methods and see if implementing
> something on them will work.

Believe me, it is not :-)

And do not forget, you don't need to do TBufDataset, but TSQLQuery.
That just implements a few simple things. The rest is taken care of by
TBufDataset.

In essence you need to define which fields you need (i.e. populate
TFieldDefs) and then a routine to copy data from the source to the buffer,
and vice versa.

If you want, you can also look at the JSON Dataset. That is quite simple.

Michael.



More information about the fpc-devel mailing list