You are not logged in.
Pages: 1
Hello,
Thank you for your answer.
I did what you said, and also did what it says on this link:
http://synopse.info/forum/viewtopic.php?pid=16790
So, I could compile and run my mORMOt Server... I updated my FPC with FPCUP lowering the branch of rtti...
Using this branch of the FPC, it is safe?
Hello,
I installed the Lazarus / FPC through the FPCUP.
Lazarus: 1.5
FPC: 3.1.1
WIn 7 64
I took the mORMotNightlyBuild.
In Synopse.inc deisei like this: {$ define PUREPASCAL}.
Created a mORMot Server, he is compiling but I get an error on the line below in mORMot.pas:
procedure TInterfaceFactoryRTTI.AddMethodsFromTypeInfo(aInterface: PTypeInfo);
P := AlignToPtr(@PPropInfo(P)^.Name[ord(PPropInfo(P)^.Name[0])+1]);
I'm thinking I did something wrong in the installation of mORMot ...
Could someone help me? even to install on Windows, and use correctly the FPCup?
Unfortunately it is not compatible with Lazarus.
Ab, which JSON Parser you recommend for Lazarus?
I did what you showed, and all tests were successful ..
So reading the sources I saw: heheheh
/ / For testing FPC, RegressionTests.exe run locally compiled with Delphi on Windows
There is one thing I could not do, call the JSONToObject, Written as follows:
var
People, People1, People2: TSQLRecordPeople;
Json: String;
People1 := TSQLRecordPeople.CreateAndFillPrepare(ClientHTTP,
'', 'ID=?', [ID]);
Json := People1.FillTable.JSON;
People2 := TSQLRecordPeople.Create;
JSONToObject(People2, Json);
ShowMessage(People2.FirstName +' '+ People2.LastName);
Above People2 is empty, But doing as is the example LCLMain.pas works:
var
People, People1, People2: TSQLRecordPeople;
Json: String;
Table: TJSONTableObject;
People1 := TSQLRecordPeople.CreateAndFillPrepare(ClientHTTP,
'', 'ID=?', [ID]);
Json := People1.FillTable.JSON;
People2 := TSQLRecordPeople.Create;
Table := TJSONTableObject.Create(Json);
Table.StepObject(People2);
ShowMessage(People2.FirstName +' - '+ People2.LastName);
What is the correct way? I can not use direct JSONToObject?
Thanks for your attention!
Hi,
I'm testing the mORMot, and am finding fantastic! A great job!
To be blunt, I wonder if I use the units in a crossplatform client project written in FPC,
it is possible to consume objects (TSQLRecord) and a mORMot server services?
I did the following test:
ORM Classes:
TUnidade = class(TSQLRecord)
private
FDescricao: RawUTF8;
FSigla: RawUTF8;
FDecimais: Integer;
published
property Descricao: RawUTF8 read FDescricao write FDescricao;
property Sigla: RawUTF8 read FSigla write FSigla;
property Decimais: Integer read FDecimais write FDecimais;
end;
TProduto = class(TSQLRecord)
strict private
FCodigo: RawUTF8;
FDescricao: RawUTF8;
FUnidade: TUnidade;
published
property Codigo: RawUTF8 read FCodigo write FCodigo;
property Descricao: RawUTF8 read FDescricao write FDescricao;
property Unidade: TUnidade read FUnidade write FUnidade;
end;
In mORMot server:
TForm1 = class(TForm)
public
Props: TSQLDBFireDACConnectionProperties;
Model: TSQLModel;
DBServer: TSQLRestServerDB;
HttpServer: TSQLHttpServer;
end;
procedure TForm1.ConfigurarAppServer;
begin
Props := TSQLDBFireDACConnectionProperties.Create(FIREDAC_PROVIDER[dMySQL]+
'?Server=127.0.0.1;Port=3306', 'mormot', 'root', 'ROOT');
TProduto.AddFilterOrValidate(TProdutoFieldName.Codigo, TProdutoCodigoValidate.Create);
Model := TSQLModel.Create([TProduto, TUnidade], 'mormot');
VirtualTableExternalRegisterAll(Model, Props);
DBServer := TSQLRestServerDB.Create(Model, ':memory:', False);
DBServer.CreateMissingTables;
HttpServer := TSQLHttpServer.Create('8080', [DBServer], '+', useHttpApiRegisteringURI);
HttpServer.AccessControlAllowOrigin := '*';
end;
In FPC client:
TForm1 = class(TForm)
public
Model: TSQLModel;
ClientHTTP: TSQLRestClientHTTP;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Model := TSQLModel.Create([TProduto, TUnidade], 'mormot/');
ClientHTTP := TSQLRestClientHTTP.Create('127.0.0.1', 8080, Model);
if (ClientHTTP.Connect) then
Label1.Caption := 'Client Connected - Port 8080';
end;
At first a simple test... But the operations of the ORM could not make it work...
See the call, Did not return anything in Prod... And the record exists in the database.
I also wrote a client in Delphi, and this usually worked, Performing the operations of the correct ORM...
procedure TForm1.Button1Click(Sender: TObject);
var
Prod: TProduto;
begin
Prod := TProduto.Create(ClientHTTP, 3, False);
ShowMessage(Prod.Descricao);
end;
Could you help me to write an client in FPC? If possible...
Pages: 1