Recent

Author Topic: Delta in Tmemdataset or Tbufdataset.  (Read 10258 times)

cappe

  • Full Member
  • ***
  • Posts: 191
Delta in Tmemdataset or Tbufdataset.
« on: November 20, 2015, 04:57:30 pm »
Is available the delta (table change) in tbufdataset or memdataset? If not, how can you implement? I intercept the changes but if there are better ideas.
Thank you

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: Delta in Tmemdataset or Tbufdataset.
« Reply #1 on: November 21, 2015, 09:47:53 am »
TMemDataSet does not maintain delta.
TBufDataSet internaly keeps delta, which is used for example by TSQLQuery (descendant of TBufDataSet) in method ApplyUpdates or CancelUpdates.
You can look into bufdataset and FUpdateBuffer private variable, which is array of changes.
(but is not published)

cappe

  • Full Member
  • ***
  • Posts: 191
Re: Delta in Tmemdataset or Tbufdataset.
« Reply #2 on: November 21, 2015, 10:44:39 am »
I was browsing in too FUpdateBuffer. How do I get access to that variable?

Thank you.

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: Delta in Tmemdataset or Tbufdataset.
« Reply #3 on: November 22, 2015, 07:05:35 pm »
As far as FUpdateBuffer is private variable, you can not access it outside bufdataset unit.
So you must change directly bufdataset unit and publish FUpdateBuffer for example by adding property to public section of TCustomBufDataset:

property UpdateBuffer: TRecordsUpdateBuffer read FUpdateBuffer

cappe

  • Full Member
  • ***
  • Posts: 191
Re: Delta in Tmemdataset or Tbufdataset.
« Reply #4 on: November 23, 2015, 10:08:13 am »
I had tried to do this. The problem is that when I compile the project says:
Error: identifier idents no member:"UpdateBuffer"

Maybe I have to compile the library fcl. How can I do?

ttomas

  • Full Member
  • ***
  • Posts: 245
Re: Delta in Tmemdataset or Tbufdataset.
« Reply #5 on: November 23, 2015, 12:28:32 pm »
You can look in laz-n-tier project
http://sourceforge.net/projects/laz-n-tier/
Newest source in File section.
Look in file OnLineQuery.pas. It is based on RxLib MemDB Dataset.
« Last Edit: November 23, 2015, 01:48:23 pm by ttomas »

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: Delta in Tmemdataset or Tbufdataset.
« Reply #6 on: November 24, 2015, 07:55:18 pm »
I had tried to do this. The problem is that when I compile the project says:
Error: identifier idents no member:"UpdateBuffer"
Can you show me your modified bufdataset.pas file ?

cappe

  • Full Member
  • ***
  • Posts: 191
Re: Delta in Tmemdataset or Tbufdataset.
« Reply #7 on: November 25, 2015, 08:54:20 am »
Fixed. allright

anderbelluno

  • New Member
  • *
  • Posts: 39
Re: Delta in Tmemdataset or Tbufdataset.
« Reply #8 on: November 09, 2018, 07:16:02 pm »
Fixed. allright

hello how did you solve it, I have the same problem
I declared the property in the public section, but it did not work out.

thanks.

ASerge

  • Hero Member
  • *****
  • Posts: 2222
Re: Delta in Tmemdataset or Tbufdataset.
« Reply #9 on: November 10, 2018, 02:47:40 am »
As far as FUpdateBuffer is private variable, you can not access it outside bufdataset unit.
If you really want...:-X For a read-only property, you can access the address of the base field, even strictly private, using constref.

anderbelluno

  • New Member
  • *
  • Posts: 39
Re: Delta in Tmemdataset or Tbufdataset.
« Reply #10 on: November 10, 2018, 08:40:12 am »
Hello budy, how are you. Thanks for answering.
I need to work with the generated Deltas and separate them into other DataSets, one for each data type.
For example, in Delphi I use FDMemTable where I make the filter as follows:

          FDMemTable1.FilterChanges: = [rtInserted];
          FDMemTable1.FilterChanges: = [rtModified];
          FDMemTable1.FilterChanges: = [rtDeleted];

That way I can copy only the data for each operation.
I'm trying to do the same for Lazarus, but I have not found a component that works that way.

Zeos has the ShowRecordsType, but I can not use third-party components, I need to use a MemoryDataSet because I do not have a direct connection to the database.

What options can you suggest me ???

Thank you very much.

anderbelluno

  • New Member
  • *
  • Posts: 39
Re: Delta in Tmemdataset or Tbufdataset.
« Reply #11 on: November 11, 2018, 07:59:30 pm »
Could someone help me with this problem?

In practice I need when I choose the type of operation (usInserted, usModified, usDeleted, usUnModified), the BufDataSet only shows these fields, since I need to generate a json with each type of operation.

For example:
I select usInserted, so BufDataSet will hide all others. So I can generate the Json only with the inserted fields.

Thanks...

rickdroio

  • Newbie
  • Posts: 1
Re: Delta in Tmemdataset or Tbufdataset.
« Reply #12 on: June 14, 2023, 07:38:12 pm »
Dears,

Have you found any solution?

lfyey121

  • Newbie
  • Posts: 3
Re: Delta in Tmemdataset or Tbufdataset.
« Reply #13 on: November 10, 2023, 08:00:35 am »
I have the same problem and I don't know how to solve it,

lfyey121

  • Newbie
  • Posts: 3
Re: Delta in Tmemdataset or Tbufdataset.
« Reply #14 on: November 10, 2023, 08:47:34 am »
When I look at the TSqlQuery code, it seems that I should implement my own subclass by overriding the applyRecUpdate method where I can get a record of all the changes

 

TinyPortal © 2005-2018