Sign in Join

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

Mailing lists / fpc-devel / 2012-09

Implementing a Dataset

9 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Felipe Monteiro de Carvalho

Hello,

I searched a bit but there seams to be no documentation showing how to implement a new dataset, correct? Any idea what is the list of minimum amount of methods which I need to implement? I really would like to implement the absolute minimum to get started. I am starting already based on what TBufDataset implements, but it is a shot in the dark...

Also, it seams that datasets now use TRecordBuffer which does not exist in my FPC 2.5.1 for Android. When was this introduced? Does it change a lot of things? Because the Android branch still doesn't work for me, so I am still stuck in my own personalized FPC 2.5.1.

Basically I want to implement a new dataset for Android which works via JNI.

thanks,

Felipe Monteiro de Carvalho

Reply by email

Unknown author
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 12 lines
Hello, I searched a bit but there seams to be no documentation showing how to implement a new dataset, correct? Any idea what is the list of minimum amount of methods which I need to implement? I really would like to implement the absolute minimum to get started. I am starting already based on what TBufDataset implements, but it is a shot in the dark... Also, it seams that datasets now use TRecordBuffer which does not exist in my FPC 2.5.1 for Android. When was this introduced? Does it change a lot of things? Because the Android branch still doesn't work for me, so I am still stuck in my own personalized FPC 2.5.1.

TRecordBuffer was - if memory serves me well - implemented by Marco for Delphi compatibility.

Basically I want to implement a new dataset for Android which works via JNI.

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.

Michael.

Reply by email

Felipe Monteiro de Carvalho
to Unknown author
Show quoted text 5 lines
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.

Felipe Monteiro de Carvalho

Reply by email

Unknown author
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 11 lines
On Mon, Sep 3, 2012 at 11:18 AM, 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.

Reply by email

Ludo Brands
to Felipe Monteiro de Carvalho: But why would this be a better solution? TBufDataset is huge ... it me it looks much…
Show quoted text 5 lines
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.

You can also take a look at rxmemds in the rx components (ccr). It is a memory only dataset and a rather clean implementation. Much easier to understand than tbufdataset.

What is it you are trying to accomplish? A dataset that can be accessed from java or the other way around, access an android integrated database (sqlite?) over jni?

Ludo

Reply by email

Felipe Monteiro de Carvalho
to Unknown author: Believe me, it is not :-) And do not forget, you don't need to do TBufDataset, but…
Believe me, it is not :-)

Could you make some theorical considerations about this? From what I see now my 2 choices are either implement a TDBDataset descendent or a TSQLConnection descendent. For me it doesn't matter either way, but TSQLConnection looks smaller and easier to implement.

I don't see how TBufDataset has anything to do with anything, I just selected it randomly as a model to study.

Felipe Monteiro de Carvalho

Reply by email