#1 2018-12-07 09:04:43

Horbs
Member
Registered: 2014-04-20
Posts: 23

CreateAndFillPrepare like Queries on the Server Side

I'm currently dveloping a WEB based client/mORMot server solution, and don't seem to have any options for generating CreateAndFillPrepare type queries on the Client side.

The current requirement is to return one or more detail table result sets to the Client based on the master table's primary key (and also limit the result set where a detail field table field matches some parameter). I'd prefer not to use SQL if possible.

I'm thinking along the lines of some kind of remote procedure call from the Client, and I'd really like to keep as much of the ORM functionality as possible.

One important constraint is that the HTTPServer will need to also support a standard Delphi client performing CreateAndFilPrepare statements against TSQL tables.

Can anyonee point me in the right direction for solving this problem?

Many thanks

Horbs

Offline

#2 2018-12-07 09:24:33

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: CreateAndFillPrepare like Queries on the Server Side

For a good client/server design, don't call the ORM from the client side.
Encapsulate them into simple interface-based services on the server side.
Use either RawJSON or array of TSQLRecord output parameters.

Offline

#3 2018-12-07 09:38:40

Horbs
Member
Registered: 2014-04-20
Posts: 23

Re: CreateAndFillPrepare like Queries on the Server Side

Thanks ab.

For generating the query, what technique should I use. I'm guessing SQL is not an ideal option.

Cheers

Horbs

Offline

#4 2018-12-07 09:51:47

Horbs
Member
Registered: 2014-04-20
Posts: 23

Re: CreateAndFillPrepare like Queries on the Server Side

Oh - should have said - using standard SQLite Server - TSQLModel.

Offline

#5 2018-12-07 09:55:35

Horbs
Member
Registered: 2014-04-20
Posts: 23

Re: CreateAndFillPrepare like Queries on the Server Side

It's OK - think I've got it - Sample 16 ?

Offline

#6 2018-12-07 10:18:31

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: CreateAndFillPrepare like Queries on the Server Side

For the query, you set the WHERE clause of the ORM parameters to the proper SQL-like expression.
See https://synopse.info/files/html/Synopse … ml#TITL_36

Some complex queries can be found in sample 31 (MVC Blog).

Offline

#7 2018-12-08 04:21:51

Horbs
Member
Registered: 2014-04-20
Posts: 23

Re: CreateAndFillPrepare like Queries on the Server Side

Thats VERY helpful AB - big thankyou.

Horbs

Offline

Board footer

Powered by FluxBB