#1 Re: mORMot 1 » Clear separation of components » 2017-07-14 18:56:46

edwinsn wrote:

@ab,

Maybe what we need is a simplified overview and getting started document written from a different perspective, or a lightweight wrapper around mORMot wink

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,

#2 Re: mORMot 1 » Deploy mORMot HTTP Server on azure as SaaS » 2017-04-28 17:58:06

turrican wrote:

You two are wrong... smile 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.

smile

#3 Re: mORMot 1 » Deploy mORMot HTTP Server on azure as SaaS » 2017-04-26 18:26:55

AFAIK, you'll need a Virtual Machine running Windows or Linux. AppServices is for "managed code" only.

#4 Re: mORMot 1 » How to set SQL Role on database connection? » 2017-03-21 17:04:56

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,

#5 Re: mORMot 1 » Why connection time is so slow ? » 2017-03-16 14:25:36

Never mind. I was missing run 1 time as 'Administrator' to http.sys registration stuff.

Regards,

#6 mORMot 1 » Why connection time is so slow ? » 2017-03-16 12:57:15

afarias
Replies: 1

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 ?

#7 Re: mORMot 1 » Expanded Json » 2017-02-23 11:52:11

d.ioannidis wrote:

  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

#8 mORMot 1 » Expanded Json » 2017-02-23 04:55:07

afarias
Replies: 2

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?

#9 mORMot 1 » How to set SQL Role on database connection? » 2017-02-22 23:40:05

afarias
Replies: 1

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.

#10 Re: mORMot 1 » Using Database View's instead of Database Table's » 2017-02-21 19:19:46

ab wrote:

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.

#11 Re: mORMot 1 » Using Database View's instead of Database Table's » 2017-02-21 17:23:20

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,

#13 Re: synopse.info » Blog not reachable » 2017-01-10 19:49:07

Hi there, synopse blog is great. Too bad until to date, the blog is still not working.

Board footer

Powered by FluxBB