Forum > Third party

Adding Delta functionality similar to TClientDataSet to Lazarus TDataSet

(1/5) > >>

szlbz:
The bufDataSet and MemDataSet that come with Lazarus lack the Delta functionality similar to TClientDataSet. This unit extends Delta from TDataSet, making it applicable to all TDataSet instances.   
 
How to use: 
1.Add DataSetDelta to the uses clause of your unit. 
2.xxxDataSet.ActivateMonitoring(true); //true--Enable the Delta functionality  false -- Stop Delta function
3.xxxDataSet.GetActionSQL(const ATableName: String; const AKeyFields: String = ''); // Generate SQL based on the Delta 
Note: 
Using GetActionSQL will clear the Delta records. 
 
How to use Delta with BufDataset: 
BufDataset1.ActivateMonitoring(true); // Enable the Delta functionality 
BufDataset1.GetActionSQL('test'); // Generate SQL based on the Delta 
=====================================================================

lazarus/fpc自带的bufDataSet和MemDataSet缺少类似TClientDataSet的Delta功能,这个单元从TDataSet扩展了Delta,可以直接生成相应的SQL,适用于所有TDataSet。
使用方法:
1、在unit的uses添加DataSetDelta
2、xxxDataSet.ActivateMonitoring(true)//启动Delta功能
3、xxxDataSet.GetActionSQL(const ATableName: String; const AKeyFields: String = '')//根据Delta返回相应的SQL

注意:
使用GetActionSQL后会清空Delta的记录

BufDataset使用Delta的方法:
BufDataset1.ActivateMonitoring(true)//启动Delta功能
BufDataset1.GetActionSQL('test');//根据Delta返回相应的SQL

https://github.com/szlbz/DataSetDelta.git

bpranoto:
I tried the example, with Lazarus 3.5/fpc 3.2.2 on linux, unfortunately it doesn't compile:

1. Required package rtcsdk_fpc is not found

2. After delete rtcsdk_fpc requirement, compilation failed

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Compile Project, Target: /home/bambang/Downloads/lazarus/components/tbufdatasetdelta/DataSetDelta/project1: Exit code 1, Errors: 38, Warnings: 2, Hints: 37Hint: Start of reading config file /home/bambang/lazarus_3.0.fixes/fpc/bin/x86_64-linux/fpc.cfgHint: End of reading config file /home/bambang/lazarus_3.0.fixes/fpc/bin/x86_64-linux/fpc.cfgVerbose: Free Pascal Compiler version 3.2.2-r0d122c49 [2024/05/21] for x86_64Verbose: Copyright (c) 1993-2021 by Florian Klaempfl and othersVerbose: Target OS: Linux for x86-64Verbose: Compiling project1.lprVerbose: Compiling unit1.pasVerbose: Compiling bufdataset.pasbufdataset.pas(70,14) Note: Virtual method "Seek(LongInt;Word):LongInt;" has a lower visibility (protected) than parent class TStream (public)bufdataset.pas(71,14) Note: Virtual method "Read(var <Formal type>;LongInt):LongInt;" has a lower visibility (protected) than parent class TStream (public)bufdataset.pas(72,14) Note: Virtual method "Write(const <Formal type>;LongInt):LongInt;" has a lower visibility (protected) than parent class TStream (public)bufdataset.pas(789,51) Hint: Parameter "size" not usedbufdataset.pas(793,15) Note: Call to subroutine "function AnsiStrLIComp(S1:PChar;S2:PChar;MaxLen:QWord):LongInt;" marked as inline is not inlinedbufdataset.pas(795,15) Note: Call to subroutine "function AnsiStrLComp(S1:PChar;S2:PChar;MaxLen:QWord):LongInt;" marked as inline is not inlinedbufdataset.pas(797,15) Note: Call to subroutine "function AnsiCompareText(const S1:AnsiString;const S2:AnsiString):LongInt;" marked as inline is not inlinedbufdataset.pas(799,15) Note: Call to subroutine "function AnsiCompareStr(const S1:AnsiString;const S2:AnsiString):LongInt;" marked as inline is not inlinedbufdataset.pas(802,55) Hint: Parameter "size" not usedbufdataset.pas(815,51) Hint: Parameter "size" not usedbufdataset.pas(815,66) Hint: Parameter "options" not usedbufdataset.pas(821,55) Hint: Parameter "size" not usedbufdataset.pas(821,70) Hint: Parameter "options" not usedbufdataset.pas(827,50) Hint: Parameter "size" not usedbufdataset.pas(827,65) Hint: Parameter "options" not usedbufdataset.pas(833,55) Hint: Parameter "size" not usedbufdataset.pas(833,70) Hint: Parameter "options" not usedbufdataset.pas(846,51) Hint: Parameter "size" not usedbufdataset.pas(846,66) Hint: Parameter "options" not usedbufdataset.pas(852,52) Hint: Parameter "size" not usedbufdataset.pas(852,67) Hint: Parameter "options" not usedbufdataset.pas(865,53) Hint: Parameter "size" not usedbufdataset.pas(865,68) Hint: Parameter "options" not usedbufdataset.pas(877,50) Hint: Parameter "size" not usedbufdataset.pas(877,65) Hint: Parameter "options" not usedbufdataset.pas(882,67) Hint: Parameter "options" not usedbufdataset.pas(887,55) Hint: Parameter "size" not usedbufdataset.pas(887,70) Hint: Parameter "options" not usedbufdataset.pas(1659,18) Error: Identifier not found "ftShortInt"bufdataset.pas(1659,28) Error: Constant Expression expectedbufdataset.pas(1660,18) Error: Identifier not found "ftByte"bufdataset.pas(1660,24) Error: Constant Expression expectedbufdataset.pas(1660,24) Error: duplicate case labelbufdataset.pas(1665,18) Error: Identifier not found "ftLongWord"bufdataset.pas(1665,29) Error: Constant Expression expectedbufdataset.pas(1665,29) Error: duplicate case labelbufdataset.pas(1665,34) Error: identifier idents no member "AsLongWord"bufdataset.pas(1665,49) Error: identifier idents no member "AsLongWord"bufdataset.pas(1673,18) Error: Identifier not found "ftExtended"bufdataset.pas(1673,29) Error: Constant Expression expectedbufdataset.pas(1673,29) Error: duplicate case labelbufdataset.pas(1673,34) Error: identifier idents no member "AsExtended"bufdataset.pas(1673,49) Error: identifier idents no member "AsExtended"bufdataset.pas(1674,18) Error: Identifier not found "ftSingle"bufdataset.pas(1674,29) Error: Constant Expression expectedbufdataset.pas(1674,29) Error: duplicate case labelbufdataset.pas(1674,34) Error: identifier idents no member "AsSingle"bufdataset.pas(1674,47) Error: identifier idents no member "AsSingle"bufdataset.pas(2189,27) Hint: Variable "ACompareStruct" of a managed type does not seem to be initializedbufdataset.pas(2539,5) Error: Identifier not found "ftShortint"bufdataset.pas(2539,15) Error: Constant Expression expectedbufdataset.pas(2539,15) Error: duplicate case labelbufdataset.pas(2540,7) Error: Identifier not found "ftByte"bufdataset.pas(2540,13) Error: Constant Expression expectedbufdataset.pas(2540,13) Error: duplicate case labelbufdataset.pas(2551,5) Error: Identifier not found "ftLongWord"bufdataset.pas(2551,18) Error: Constant Expression expectedbufdataset.pas(2551,18) Error: duplicate case labelbufdataset.pas(2568,5) Error: Identifier not found "ftExtended"bufdataset.pas(2568,18) Error: Constant Expression expectedbufdataset.pas(2568,18) Error: duplicate case labelbufdataset.pas(2569,5) Error: Identifier not found "ftSingle"bufdataset.pas(2569,18) Error: Constant Expression expectedbufdataset.pas(2569,18) Error: duplicate case labelbufdataset.pas(2946,29) Warning: Symbol "ApplyRecUpdate" is deprecatedbufdataset.pas(3093,36) Error: Identifier not found "SErrUpdatesInProgess"bufdataset.pas(4402,14) Hint: Local variable "s" of a managed type does not seem to be initializedbufdataset.pas(4469,29) Hint: Local variable "Buf" does not seem to be initializedbufdataset.pas(4475,18) Hint: Local variable "Buf" does not seem to be initializedbufdataset.pas(4478,32) Hint: Variable "AUpdOrder" does not seem to be initializedbufdataset.pas(4517,13) Warning: Implicit string type conversion from "AnsiString" to "UnicodeString"bufdataset.pas(4518,48) Error: identifier idents no member "ReadUnicodeString"bufdataset.pas(4526,24) Hint: Local variable "B" of a managed type does not seem to be initializedbufdataset.pas(4578,20) Error: identifier idents no member "WriteUnicodeString"bufdataset.pas(4601,14) Hint: Local variable "s" of a managed type does not seem to be initializedbufdataset.pas(4799,0) Verbose: There were 38 errors compiling module, stoppingVerbose: Compilation abortedVerbose: /home/bambang/lazarus_3.0.fixes/fpc/bin/x86_64-linux/ppcx64 returned an error exitcode 
If it works, it will be very useful. Currently, I use TKbmMemTable for the same feature.

szlbz:
Delete  rtcsdk_fpc

Project has been updated, please download again

bpranoto:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Hint: (11030) Start of reading config file /home/bambang/lazarus_3.0.fixes/fpc/bin/x86_64-linux/fpc.cfgHint: (11031) End of reading config file /home/bambang/lazarus_3.0.fixes/fpc/bin/x86_64-linux/fpc.cfgFree Pascal Compiler version 3.2.2-r0d122c49 [2024/05/21] for x86_64Copyright (c) 1993-2021 by Florian Klaempfl and others(1002) Target OS: Linux for x86-64(3104) Compiling project1.lpr(3104) Compiling unit1.pas(3104) Compiling DataSetDelta.pas/home/bambang/Downloads/lazarus/components/tbufdatasetdelta/DataSetDelta/DataSetDelta.pas(81,39) Warning: (4046) Constructing a class "TBufDataset" with abstract method "LoadBlobIntoBuffer"/home/bambang/lazarus_3.0.fixes/fpc/units/x86_64-linux/fcl-db/bufdataset.ppu:bufdataset.pas(620,15) Hint: (5062) Found abstract method: LoadBlobIntoBuffer(<TCustomBufDataset>;TFieldDef;PBufBlobField);/home/bambang/Downloads/lazarus/components/tbufdatasetdelta/DataSetDelta/DataSetDelta.pas(95,39) Warning: (4046) Constructing a class "TBufDataset" with abstract method "LoadBlobIntoBuffer"/home/bambang/lazarus_3.0.fixes/fpc/units/x86_64-linux/fcl-db/bufdataset.ppu:bufdataset.pas(620,15) Hint: (5062) Found abstract method: LoadBlobIntoBuffer(<TCustomBufDataset>;TFieldDef;PBufBlobField);/home/bambang/Downloads/lazarus/components/tbufdatasetdelta/DataSetDelta/DataSetDelta.pas(78,27) Note: (5025) Local variable "LFieldValue" not used/home/bambang/Downloads/lazarus/components/tbufdatasetdelta/DataSetDelta/DataSetDelta.pas(157,3) Note: (5025) Local variable "s" not used/home/bambang/Downloads/lazarus/components/tbufdatasetdelta/DataSetDelta/DataSetDelta.pas(176,3) Note: (5025) Local variable "FieldDef" not used/home/bambang/Downloads/lazarus/components/tbufdatasetdelta/DataSetDelta/DataSetDelta.pas(225,34) Error: (5000) Identifier not found "ftOraTimeStamp"/home/bambang/Downloads/lazarus/components/tbufdatasetdelta/DataSetDelta/DataSetDelta.pas(294,41) Error: (4025) Incompatible type for arg no. 1: Got "Char", expected "Byte"/home/bambang/lazarus_3.0.fixes/fpc/units/x86_64-linux/rtl/system.ppu:systemh.inc(1208,10) Hint: (5039) Found declaration: Chr(Byte):Char; InternProc;/home/bambang/Downloads/lazarus/components/tbufdatasetdelta/DataSetDelta/DataSetDelta.pas(294,50) Error: (4025) Incompatible type for arg no. 1: Got "Char", expected "Byte"/home/bambang/lazarus_3.0.fixes/fpc/units/x86_64-linux/rtl/system.ppu:systemh.inc(1208,10) Hint: (5039) Found declaration: Chr(Byte):Char; InternProc;/home/bambang/Downloads/lazarus/components/tbufdatasetdelta/DataSetDelta/DataSetDelta.pas(316,53) Error: (4025) Incompatible type for arg no. 1: Got "Char", expected "Byte"/home/bambang/lazarus_3.0.fixes/fpc/units/x86_64-linux/rtl/system.ppu:systemh.inc(1208,10) Hint: (5039) Found declaration: Chr(Byte):Char; InternProc;/home/bambang/Downloads/lazarus/components/tbufdatasetdelta/DataSetDelta/DataSetDelta.pas(316,62) Error: (4025) Incompatible type for arg no. 1: Got "Char", expected "Byte"/home/bambang/lazarus_3.0.fixes/fpc/units/x86_64-linux/rtl/system.ppu:systemh.inc(1208,10) Hint: (5039) Found declaration: Chr(Byte):Char; InternProc;/home/bambang/Downloads/lazarus/components/tbufdatasetdelta/DataSetDelta/DataSetDelta.pas(320,98) Error: (4025) Incompatible type for arg no. 1: Got "Char", expected "Byte"/home/bambang/lazarus_3.0.fixes/fpc/units/x86_64-linux/rtl/system.ppu:systemh.inc(1208,10) Hint: (5039) Found declaration: Chr(Byte):Char; InternProc;/home/bambang/Downloads/lazarus/components/tbufdatasetdelta/DataSetDelta/DataSetDelta.pas(320,107) Error: (4025) Incompatible type for arg no. 1: Got "Char", expected "Byte"/home/bambang/lazarus_3.0.fixes/fpc/units/x86_64-linux/rtl/system.ppu:systemh.inc(1208,10) Hint: (5039) Found declaration: Chr(Byte):Char; InternProc;DataSetDelta.pas(338) Fatal: (10026) There were 7 errors compiling module, stoppingFatal: (1018) Compilation abortedError: /home/bambang/lazarus_3.0.fixes/fpc/bin/x86_64-linux/ppcx64 returned an error exitcode  

bpranoto:
I fixed the errors. Here is the diff file to fix the compilation.

Navigation

[0] Message Index

[#] Next page

Go to full version