You are not logged in.
Hello,
pls show me the way or a part of the documentation...
Environment: UniDAC + MySQL.
I have interface based services.
On Server side I got a collection of TPersistent DTOs as in [..\SQLite3\Samples\20 - DTO interface based service] sample.
Everything works good but a bit slow.
unit uServiceBehandlerDef;
interface
uses
SysUtils, mormot, uServiceInterfaces, uModel, uModelDB, uServer;
type
TBehandlerDefPostService = class(TInterfacedObject, IBehandlerDefPostService)
public
procedure Post(const items: TDTOBehandlerDefs);
end;
implementation
procedure TBehandlerDefPostService.Post(const items: TDTOBehandlerDefs);
var
obj: TBehandlerDef;
i: Integer;
dto: TDTOBehandlerDef;
begin
aRestServer.Delete(TBehandlerDef, Format('Username=''%s''', [ServiceContext.Request.SessionUserName]));
for i := 0 to items.Count - 1 do
begin
obj := TBehandlerDef.Create;
try
dto := TDTOBehandlerDef(items[i]);
obj.BDEF_NR := dto.BDEF_NR;
obj.INTERN_NAME := dto.INTERN_NAME;
obj.EXTERN_NAME := dto.EXTERN_NAME;
aRestServer.Add(obj, True);
finally
obj.Free;
end;
end;
end;
end.
I would like to use bulk mysql insert on the server side.
I see the method Batch but do not understand how I should use it.
TSQLRestServer = class(TSQLRest)
procedure Batch(Ctxt: TSQLRestServerURIContext);
Thanks.
Offline
Offline
The solution from [12.3.3.1. Several Batches] works like a charm.
Thanks a lot for the great help!
Offline