Jump to content
Andrzej

TDataSet emulation without database

Recommended Posts

I make examples after https://www.kvrsoft.com/articles/delphi-articles/database/db-controls.html. Also I see

TGXBaseDataset and Paradox dataset from Github (I save here too many links)

I attach example.

It is half succeeded:

- is numer of records

- record nubers are continuus from start to last

- two defined columns

 

But I can't make any field visible, only header fields are visible.

How make even fake field data iike 'abc'?

I attached dpk with two components and test app.

send.zip

Share this post


Link to post

Why don't you use?:

-kbmmemtable

-clientdataset

-fdmemtable

-zmemtable

 

Michał

  • Like 1

Share this post


Link to post

Must be simple, free with sources, no sql. 

I will next create other based on it, for example read data from csv files.

Own DataSource is simpler than own DataSet?

Edited by Andrzej

Share this post


Link to post

I see that the code is a mess concerning the use of override instead of overload.

 

If you compile this, watch all the warnings you get (and fix them).

 

I think TDataSet has changed since the creation of this additional code and you now need to use overload on many places.

Otherwise your own SetData etc aren't executed and your records aren't populated (which you are experiencing).

You'll notice the execution of your code never reaches your EditDataSet1PerformSetFieldData() event.

 

Share this post


Link to post

And is there a reason not to use the traditional Insert etc.

Like

  EditDataSet1.Insert;
  EditDataSet1.FieldByName('number').AsString := 'a';
  EditDataSet1.FieldByName('square').AsString := 'b';
  EditDataSet1.Post;


 

Share this post


Link to post

Clientdataset seems a good idea but it requires stupid midas.dll IIRC. Alas, the implementation should be as simple as, f.ex., TStream descendant, but it's too complex actually. There was Marco Cantu's article "A Dataset with no Database" (link is obsolete now) which I used to create my own primitive implementation when I needed a grid with word wrapping. For simplicity it's only able to store strings.

Share this post


Link to post
1 hour ago, Fr0sT.Brutal said:

Clientdataset seems a good idea but it requires stupid midas.dll IIRC.

Not when you add MidasLib to the uses clause.

  • Thanks 1

Share this post


Link to post
40 minutes ago, Uwe Raabe said:

Not when you add MidasLib to the uses clause.

It's been a very long time ago, so my info might not be correct now, but as far as I can remember there is a bug in MidadLib that does not exist in midas.dll. As stated, it might not be the case any longer.

Share this post


Link to post

With overload - start working.

I attach sample:

with IntToStr(FCursor)

But it fill all visible rows of grid with this value. Probably I must use cache but I don't know how much visible rows  has grid in dataset.

What is standard way to do with them?

 

send2.zip

 

solution: ActiveBuffer:

IntToStr(PRecordBuffer(ActiveBuffer)^.RecordIndex); give me correct

Edited by Andrzej
soltion

Share this post


Link to post

Have a look at the AdapterBindSource example.  It's installed by Delphi, on my machine at: C:\Users\Public\Documents\Embarcadero\Studio\21.0\Samples\Object Pascal\LiveBindings\AdapterBindSource.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×