You are not logged in.
Pages: 1
@ab,
Maybe what we need is a simplified overview and getting started document written from a different perspective, or a lightweight wrapper around mORMot
I second that.
For instance, trying to use only SOA part of Mormot it's exausting (at start) for a newbee as there are so many things mixed up.
Regards,
You two are wrong... I will upload the instructions when I finished the deployment. But I did it.
That's great to know. Thanks.
Although, I full CentOS VM with SSD for database persistence is still cheaper.
AFAIK, you'll need a Virtual Machine running Windows or Linux. AppServices is for "managed code" only.
Hi there, just figure it out. So, for anyone in the future:
Not very intuitive but (I just found out) you can pass an ilimited number of parameters using the AServerName on ConnectionProperties constructor, so in my case was:
URI := FIREDAC_PROVIDER[dFirebird] + '?RoleName=SomeDbRole';
fProperties := TSQLDBFireDACConnectionProperties.Create(URI, DB_PATH, DB_USERNAME, DB_PASSWORD);
Simple as that
Regards,
Never mind. I was missing run 1 time as 'Administrator' to http.sys registration stuff.
Regards,
Hi there. I've just build a simple Http web service while learning Mormot.
Everything is working well but connection time (measured using ARC -- Advanced Rest Client Application) seems very slow (a little more than 1 second) when usually should be less than 10 ms
My server is defined like this:
TMyHttpServer = class
private
FModel: TSQLModel;
FRestServer: TSQLRestServer;
FHttpServer: TSQLHttpServer;
public
constructor Create(AProps: TSQLDBConnectionProperties; const APort: RawUTF8);
destructor Destroy; override;
end;
TMyRestServer = class(TSQLRestServerFullMemory)
private
FProps: TSQLDBConnectionProperties;
public
constructor Create(AModel: TSQLModel; AProps: TSQLDBConnectionProperties); reintroduce; overload;
published
procedure SomeResource(Ctxt: TSQLRestServerURIContext);
end;
And implemented this way:
constructor TMyHttpServer.Create(AProps: TSQLDBConnectionProperties; const APort: RawUTF8);
const
ROOT_PATH = 'root';
HTTP_OPTN: TSQLHttpServerOptions = UseHttpApiRegisteringURI;
begin
inherited Create;
with TSQLLog.Family do
begin
Level := [sllNone];
PerThreadLog := ptIdentifiedInOnFile;
end;
FModel := TSQLModel.Create([], ROOT_PATH);
FRestServer := TMyRestServer.Create(FModel, AProps);
FHttpServer := TSQLHttpServer.Create(APort, [FRestServer], '+', HTTP_OPTN);
FHttpServer.AccessControlAllowOrigin := '*';
end;
constructor TMyRestServer.Create(AModel: TSQLModel; AProps: TSQLDBConnectionProperties);
begin
inherited Create(AModel, False);
FProps := AProps;
end;
And here is the console app code:
var
FProps: TSQLDBConnectionProperties;
FConnection: TSQLDBConnection;
begin
FProps := FunctionToCreateDBConnectionProps.Create('DB_PATH', 'DB_USER', 'DB_PASS');
try
FConnection := FProps.ThreadSafeConnection;
if not FConnection.Connected then
FConnection.Connect;
with TMyHttpServer.Create(FProps, HTTP_PORT) do
try
Readln;
finally
Free;
end;
finally
FProps.Free;
end;
end.
Any hints ?
try with GET /root/Contact?select=*
Hi ioannidis, that did the trick. Thank you very much.
Do you know a way to make it 'default' so that when someone request /root/contact is "redirected" to /root/contact?select=*
?
Thanks again,
Regards
Probably a silly question but can't find out a solution.
Lets say I have
TContact = class(TSQLRecord)
with Name, PhoneNumber properties
If I do
GET /root/Contact
I only get the IDs [{"RowID":1}, {"RowID":2}]
I'd like the get the full objects list, [{"RowID":1, "Name":"Joe", "PhoneNumber":"555-8172"}, {"RowID":2,"Name":"Lucy","PhoneNumber":"555-9182"}]
I've read the docs on NoAJAXJSON but it does not help
Any tips?
I'm using FireDAC to connect to Firebird and could not figure out how to set user SQL Role
URI := FIREDAC_PROVIDER[dFirebird];
fProperties := TSQLDBFireDACConnectionProperties.Create(URI, DB_PATH, DB_USERNAME, DB_PASSWORD); // what about USER ROLE?
Since I don't want to connect using SYSDBA.
Another database connection param needed to set is database CharacterSet.
Any help is appreciated.
There is no mapping for your external view...
Yes, just for the view name:
VirtualTableExternalMap(fModel, TEmployee, fProperties, 'VW_EMPLOYEE');
Field names match the TEmployee class property names.
I have the same issue. The generated SQL is fine (and works as expected returnig 1 row if run against the DB) but a 404 error "not found" is written to log.
20170221 17103709 B SQL SynDBFireDAC.TSQLDBFireDACStatement(03744180) select ID,EmployeeName,EmployeeRole,AdmissionDate from vw_Employee where ID=1
20170221 17103711 A debug mORMotSQLite3.TSQLRestServerDB(0372D470) TSQLRestRoutingREST.Error: { "errorCode":404, "errorText":"Not Found" }
20170221 17103711 A srvr mORMotSQLite3.TSQLRestServerDB(0372D470) GET root/Employee ORM-Get -> 404 with outlen=47 in 173806 us
20170221 17103711 ! clnt mORMotHttpClient.TSQLHttpClientWinHTTP(036D30D0) GET root/Employee/1 status=404 len=47 state=5
20170221 17103711 ! ERROR mORMotHttpClient.TSQLHttpClientWinHTTP(036D30D0) GET root/Employee/1 returned 404 (Not Found) with message { "errorCode":404, "errorText":"Not Found" }
Here's the code I'm using:
fModel := CreateModel;
fDriver := TFDPhysIBDriverLink.Create(nil);
fDriver.VendorLib := 'fbclient.dll';
URI := FIREDAC_PROVIDER[dFirebird];
fProperties := TSQLDBFireDACConnectionProperties.Create(
URI, DB_PATH, DB_USER, DB_PASS);
VirtualTableExternalRegisterAll(fModel, fProperties);
VirtualTableExternalMap(fModel, TEmployee, fProperties, 'VW_EMPLOYEE');
fRestServer := TSQLRestServerDB.Create(fModel, SQLITE_MEMORY_DATABASE_NAME, False);
fRestServer.AcquireExecutionMode[execORMGet] := amBackgroundThread;
fRestServer.AcquireExecutionMode[execORMWrite] := amBackgroundThread;
fRestServer.CreateMissingTables;
(..)
If I just change the view name 'VW_EMPLOYEE' with the table name 'EMPLOYEE' than it works.
Regards,
Nice!
Hi there, synopse blog is great. Too bad until to date, the blog is still not working.
Promissing!
Win32 only => :'(
Pages: 1