Delta in Tmemdataset or Tbufdataset. lazarus / 16-Databases ---------------------------------------------------------------------- cappe · 2015-11-20 15:57 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 · 2015-11-21 08:47 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 · 2015-11-21 09:44 I was browsing in too FUpdateBuffer. How do I get access to that variable? Thank you. ---------------------------------------------------------------------- LacaK · 2015-11-22 18:05 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 · 2015-11-23 09:08 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 · 2015-11-23 11:28 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. ---------------------------------------------------------------------- LacaK · 2015-11-24 18:55 Quote from: cappe on November 23, 2015, 10:08:13 amI 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 · 2015-11-25 07:54 Fixed. allright ---------------------------------------------------------------------- anderbelluno · 2018-11-09 18:16 Quote from: cappe on November 25, 2015, 08:54:20 amFixed. 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 · 2018-11-10 01:47 Quote from: LacaK on November 22, 2015, 07:05:35 pmAs far as FUpdateBuffer is private variable, you can not access it outside bufdataset unit. If you really want... For a read-only property, you can access the address of the base field, even strictly private, using constref. ---------------------------------------------------------------------- anderbelluno · 2018-11-10 07:40 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 · 2018-11-11 18:59 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 · 2023-06-14 17:38 Dears, Have you found any solution? ---------------------------------------------------------------------- lfyey121 · 2023-11-10 07:00 I have the same problem and I don't know how to solve it, ---------------------------------------------------------------------- lfyey121 · 2023-11-10 07:47 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