You are not logged in.
Hi everyone,
I'm encountering an exception within the TRestOrmServer.RecordVersionSynchronizeSlave function when using a synchronization model with only one table.
The issue seems to lie within mormot.orm.server, specifically around line 854:
if (t > PtrUInt(length(fRecordVersionMax))) or (fRecordVersionMax[t] = 0) then
InternalRecordVersionMaxFromExisting(t, {next=}false);
My model is defined as follows:
FModel := TOrmModel.Create([TMasterDataVersioned]);
The exception occurs only with this single-table model. If I define the model with additional tables, like so:
FModel := TOrmModel.Create([TMasterData, TMasterDataVersioned]);
or
FModel := TOrmModel.Create([TOrmTableDeleted, TMasterDataVersioned]);
the synchronization works correctly.
I've found a workaround by modifying the TRestOrmServer.RecordVersionSynchronizeSlave function as follows:
if (length(fRecordVersionMax) = 0) or (t > PtrUInt(length(fRecordVersionMax))) or (fRecordVersionMax[t] = 0) then
InternalRecordVersionMaxFromExisting(t, {next=}false);
With this change, the function operates as expected. Is this a known issue?
Could someone explain why this workaround is necessary and if there's a more appropriate solution?
Thanks in advance for any assistance.
Offline
This was indeed a regression when converting to mORMot 2.
Please try with https://github.com/synopse/mORMot2/commit/0f2a2ae0
Offline
Hi Arnaud,
Thank you very much. It works as expected now.
Offline