#1 2016-05-15 14:47:21

HollosCs
Member
Registered: 2015-12-08
Posts: 56

Crossplatform,TSQLRestClientHTTP - server type

Hi!

Create a small program (based on 27 - CrossPlatform Clients). Server run on Windows 10 PC, client run Android 6.01, FireMonkey.
Connection is successfully.

Question:
- What kind of server to connect with Crossplatform TSQLRestClientHTTP client?
- Is feasible: Crossplatform TSQLRestClientHTTP client edirect execute a SQL statement, like TSQLDBSQLite3ConnectionProperties.Execute('SELECT * FROM table1')

Thanks, Csaba

Offline

#2 2016-05-15 15:57:25

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

Re: Crossplatform,TSQLRestClientHTTP - server type

You should not execute a SQL statement from the client side.
The SQL logic should remain on the server.
Do not think 2-Tier, think multi-Tier!
See http://synopse.info/files/html/Synopse% … #TITLE_115

To retrieve all items, you need to use the corresponding ORM methods, like TSQLRecord.FillPrepare().
For more complex queries, define your high-level SOA service, returning the information you need.

Offline

#3 2016-05-15 16:22:21

HollosCs
Member
Registered: 2015-12-08
Posts: 56

Re: Crossplatform,TSQLRestClientHTTP - server type

OK, I understand that.

From client side (FireMonkey, Android) can I connect to server via interface for not ORM server?

server side:
Props := TSQLDBSQLite3ConnectionProperties.Create('data.db3','','','');
HttpServer := TSQLDBServerHttpApi.Create(Props,'syndbremote','8092','user','pass');

client side:
  client := TSQLRestClientHTTP.Create('????', 8092, TSQLModel.Create([]));

What is the connection string <server address>, or this way is not compatible ?

Csaba

Offline

#4 2016-05-15 16:44:53

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

Re: Crossplatform,TSQLRestClientHTTP - server type

No, the SynDBRemote feature is not cross-platform yet.
It is not meant to be run from a cross-platform client.
This is on purpose, for the reasons I wrote in my previous reason: it would be  a 2-Tier architecture, which is a wrong design for mobile clients.

Define SOA interface-based services for remote access from an Android or iOS client instead.
Never put your SQL on the mobile side!

Offline

#5 2016-05-15 20:19:38

HollosCs
Member
Registered: 2015-12-08
Posts: 56

Re: Crossplatform,TSQLRestClientHTTP - server type

OK, this is a wrong way.

What is your recommendation?

Have a legacy project with SQLite database, Dephi standalone client.

My plan: SQLite database (external for first time, ORM later step by step), one backend server with interface-based service.
-Local net the fastest data transfer (many data manipulation, many user), only Delphi
-Mobil client only data read. Delphi or Android java.

Make I two server one for local and one for mobile or one server for both?
Which kind of server? TSQLRestServerDB or TSQLRestServerFullMemory?

Thank, Csaba

Offline

#6 2016-05-16 09:28:03

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

Re: Crossplatform,TSQLRestClientHTTP - server type

For a pure SOA server, TSQLRestServerFullMemory is enough.

TSQLRestServerDB has the advantage of being able to directly connect to your SQlite3 database, with all the remote RESTful access, and the ORM features for your SOA server.

So I would use TSQLRestServerDB from the beginning.
Switching to ORM as soon as possible, since I do not see any benefit of plain SQL over our ORM, for most use cases.

Offline

Board footer

Powered by FluxBB