#2 mORMot 1 » Bug in TSQLRecordMany.ManyAdd » 2022-03-21 13:21:48

manoirx
Replies: 2

function TSQLRecordMany.ManyAdd(aClient: TSQLRest; aSourceID, aDestID: TID;
  NoDuplicates: boolean; aUseBatch: TSQLRestBatch): boolean;

begin
  result := false;
  if (self=nil) or (aClient=nil) or (aSourceID=0) or (aDestID=0) or
     (fSourceID=nil) or (fDestID=nil) then
    exit; // invalid parameters
  if NoDuplicates and
     (InternalIDFromSourceDest(aClient,aSourceID,aDestID)<>0) then
      exit; // this TRecordReference pair already exists
  fSourceID^ := aSourceID; <--- assigned int64 to integer
  fDestID^ := aDestID; <--- assigned int64 to integer
  if aUseBatch<>nil then
    result := aUseBatch.Add(self,true)>=0 else
    result := aClient.Add(self,true)<>0;
end;





TSQLRecordMany = class(TSQLRecord)
  protected
   
    fSourceID: PPtrInt;  <-- integer
    fDestID: PPtrInt; <-- integer


model class that use IDGenerator -> ID generate int64 number value > 2147516417 will rounded to 2147516417

for example
model.SetIDGenerator(Txxxx,1);

the ID will rounded from 3538742966002679809 to 2147516417 for data that stored in DB from class inherited from TSQLRecordMany  (Tested with MongoDB)

Board footer

Powered by FluxBB