Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRecordVersion doesn't work as expected #193

Closed
avavdoshin opened this issue May 30, 2023 · 4 comments
Closed

TRecordVersion doesn't work as expected #193

avavdoshin opened this issue May 30, 2023 · 4 comments

Comments

@avavdoshin
Copy link

Hello, Arnaud!

I'm stuck with TRecordVersion handling and batch updates.
SQlite db via sqlite3static.
Batch add works perfect, TRecordVersion increments as expected.
But for batch updates via TRestBatch only few of TOrms update their TRecordVersion field, for others TRecordVersion field stays remained.

Maybe i'm doing something wrong way? First i load my TOrm from DB via CreateAndFillPrepared, then i modify some fields and add TOrm to batch via TRestBatch.add(TOrm, true) (repeat this for all my TOrm i need to change). Then I use batchSend for sending changes to db.

I can see that TRecordVersion doesn't change because i store date/time timestamp in my TOrm class and change it for every update.

@avavdoshin
Copy link
Author

avavdoshin commented May 31, 2023

FPC 3.3.1, x86_64, windows 10 (codetyphon 8.0). Mormot2 github version 2.1.5479

Whole example too complicated, here is simplified part of code in attached file
example.txt

@avavdoshin
Copy link
Author

working simple example which you can reproduce (with results in csv) here https://gist.github.com/avavdoshin/fd1d829924940b1064a06df8f0638691
Record versions in this example doesn't changes for updates, so this changes will not be replicated to slave database.

synopse pushed a commit that referenced this issue Aug 23, 2023
synopse pushed a commit that referenced this issue Aug 23, 2023
@synopse
Copy link
Owner

synopse commented Aug 23, 2023

@avavdoshin
Should be fixed now with the last commit above.
At least, I have included BatchUpdate() to the regression tests, which failed and now pass as expected.
Sorry for the delay.

Your feedback is welcome.

@synopse
Copy link
Owner

synopse commented Aug 24, 2023

Should be good now.

Please reopen if needed, or post on our forum.

@synopse synopse closed this as completed Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants