You are not logged in.
Pages: 1
This question might only be relevant to those who have used Ericks sample code (in his two Elevate Web Builder and mORMot books).
Background ...
I've started my first mORMot / EWB project and decided to begin by refactoring Example1.wbp from Erick Engelke's books, which fills a EWB Dataset via a request to the mORMot server (Server18 mORMot sample in Erick's source code). Ericks example runs fine on my machine. The sample I refactored (to use my SQLite database) failed ( opening bracket "{" was missing from the response being sent to the fill method).
Now I've tested the mORMot server using a Delphi VCL Client I wrote - and all CRUD operations work fine using the delphi client so I'm pretty sure the problem doesn't lie with the Server end.
I then tried Ericks example 2, and refactored it for my Server. I'm able to do CRUD operations on single records, but once again this sample fails when I try to add code to fill a EWB Client Dataset.
There are 2 diferent versions of the wrapper that I have tried (ewbmormot.wbs) - one is 123 kb, the other is 104 kb. The 104 k version does nothing (no errors that I've been able to trap, and an empty dataset after the operation), the 123 k version gives me the missing opening bracket error.
So my question is ....
Has anyone else tried what I'm attempting and found the same problem - and a solution ?
PS : Erick is working on a new version of his ewbmormot.wbs - but for now I'm really late on delivery of this project so any advice would be greatly appreciated. The problem is unlikely to lie in Erick's wrapper - but of my understanding as to how it works (I'm really struggling to get my head around it).
Thanks
Horbs
Offline
Just some further information to describle what I've done.
The mormot server is pretty standard :
procedure TfrmMain.FormCreate(Sender: TObject);
begin
Model := CreateSampleModel;
DB := TSQLRestServerDB.Create(Model, 'PopitBookings.db3', False);
DB.CreateMissingTables;
Server := TSQLHttpServer.Create('8080',[DB],'+',HTTP_DEFAULT_MODE);
Server.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries
end;
On the EWB Side I've refactored Sample1 as follows
Replaced the 'Fish" mormot table with my Customer table definition.
Replaced all instances of Fish with Customer.
Define the DataSet1 fields as per the "Customer" table.
Modified and added the Grid columns as per the Customer table.
Added a MultiLineEdit control to the form for debugging.
In the ewbmormot procedure TForm1.OnPopulate( s : string ); method I have :
MultiLineEdit1.Lines.Add(s);
DataSet1.Open;
DataSet1.LoadRows( s );
Now when I run the client, I get "Expected "{", instead found } at 0"
and the MultiLineEdit shows "}"
I've tested the server operations with a Delphi VCL Client (using SynReatDatasets in a one to many configuration) and I can perform all CRUD operations against all 5 tables - so I just can't figure what's wrong on the EWB side - Erick's Sample1 program works fine on my machine using the Sample18 server and "Fish" tables.
Thanks
Horbs
Last edited by Horbs (2018-11-21 01:45:43)
Offline
Hi Horbs,
I got both Erick books, but finaly I decided to not use his wrapper (it is a little bit complicated for a newbie like me).
I'm tying to play with the couple EWB/Mormot.
Anyway, I've got a problem about JSON unserialization on the client side. I don't know if this is relevant for you, but the JSON coming from Mormot was not OK for EWB.
I fixed it (very dirty) like this for the moment:
GridJSON :=StrReplace(Request.ResponseContent.Text,'"result":[', '"rows":');
GridJSON :=StrReplace(GridJSON,']}', '}');
If you have the rigth solution for this , let me know please.
DKA
Offline
Pages: 1