You are not logged in.
Pages: 1
Delphi 11.1, mORMot commit 2d598b6
When I want to delete multiple ORM objects that have a RecordVersion property, I get an exception (ExceptionMessage = EOrmBatchException: TRestBatch "i" with TOrmTableDeleted whereas expects TOrmTest). Single deletion works. The following example shows the problem:
program MultiDelete;
{$APPTYPE CONSOLE}
uses
{$I mormot.uses.inc}
System.SysUtils, mormot.core.base, mormot.core.unicode, mormot.orm.base, mormot.orm.core, mormot.rest.sqlite3, mormot.db.raw.sqlite3.static;
type
TOrmTest = class(TOrm)
private
FRecVersion: TRecordVersion;
published
property RecVersion: TRecordVersion read FRecVersion;
end;
procedure Main;
var
i: Integer;
item: TOrmTest;
restServer: TRestServerDB;
begin
restServer := TRestServerDB.CreateWithOwnModel([TOrmTest], ChangeFileExt(ParamStr(0), '.dat'));
try
restServer.CreateMissingTables;
item := TOrmTest.Create;
try
for i := 1 to 10 do
restServer.Add(item, True);
finally item.Free; end;
restServer.Server.Delete(TOrmTest, 'RowID>?', [2]);
finally restServer.Free; end;
end;
begin
try
Main;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
ReadLn;
end.
With best regards
Thomas
Offline
You are right.
It should be fixed by https://github.com/synopse/mORMot2/commit/0455b964
It was also affecting mORMot 1 - I fix it for it too.
Offline
Pages: 1