You are not logged in.
Pages: 1
Hello every one
When I create my client as VCL App. I got this error: TForm1 is not part of TSQLMODEL root
When I create my client as console App. it works just fine.
What do I miss here?
Delphi 10.4.2
Mormot 1 2023
Offline
Thank you AB, now works fine
Offline
When I run my clint it took more than 2s to insert one record!
How can I make it faster?
Server: localhost
Client: on the same computer (local)
Server:
procedure TForm1.FormCreate(Sender: TObject);
begin
Model := TSQLModel.Create([TNote],'root');
DB := TSQLRestServerDB.Create(Model,ChangeFileExt(paramstr(0),'.db3'));
DB.CreateMissingTables;
Server := TSQLHttpServer.Create('8080',[DB],'+',useHttpApiRegisteringURI);
Server.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries
end;
Client:
begin
aModel := TSQLModel.Create([TNote],'root');;
try
aClient := TSQLHttpClientWinHTTP.Create('localhost','8080',aModel);
try
writeln('Add a new TPerson');
timer.Start;
aPerson := TNote.Create;
try
Randomize;
aPerson.Body := 'eliaasoooo'+Int32ToUtf8(Random(10000000));
aID := aClient.Add(aPerson,true);
finally
aPerson.Free;
end;
writeln('Processed in ',Ansi7ToString(Timer.Stop));
writeln('Added TPerson.ID=',aID);
aPerson := TNote.Create(aClient,aID);
try
writeln('Name read for ID=',aPerson.ID,' from DB = "',aPerson.Body,'"');
finally
aPerson.Free;
end;
finally
aClient.Free;
end;
write(#10'Press [Enter] to quit');
readln;
finally
aModel.Free;
end;
end.
Using Postman -> post -> 41ms
Last edited by yanchung (2023-06-13 12:59:34)
Offline
I am not able to reproduce it here.
Do you have a proxy or a particular corporate network configuration on this PC?
Did you try on another computer?
Try to debug a bit to find out what low-level API call takes 2 seconds.
Try to use TSqlRestHttpClientWinSock instead of the WinHTTP.
And for any new project, consider mORMot 2 instead of mORMot 1.
Offline
I hosted my Server in Remote VPS and it now takes ~552 ms.
Offline
Pages: 1