#1 2013-11-19 07:50:19

nirnir
Member
Registered: 2013-11-11
Posts: 66

serving TDBXReader/TclientDataset objects

I'm  migrating my datasnap application to mormot .

I have a lot of old code which I don't want to rewrite and for this i'll use mormot only for client/server via interfaces .

On the server side I work directly(without mormot) with MsSQL
on the client side I use DevExpress grid which expect TDBXReader or TclientDataset .

My question is how can I return TDBXReader or TclientDataset  objects from the server

Offline

#2 2013-11-19 15:17:33

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

Re: serving TDBXReader/TclientDataset objects

You can take a look at "17 - TClientDataset use" and "16 - Execute SQL via services".

Your interface based-service could return the data as RawJSON content (see sample 16), then on the client side, convert it into a TDataSet (see sample 17).

Online

#3 2013-11-19 17:13:02

nirnir
Member
Registered: 2013-11-11
Posts: 66

Re: serving TDBXReader/TclientDataset objects

Thanks,
But if I have an old code returning TDBXReader ,  do you have a fast converter from TDBXReader  to RawJSON ?

Offline

#4 2013-11-19 19:30:04

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

Re: serving TDBXReader/TclientDataset objects

RawJSON is just some JSON content, encoded as UTF-8.

So you can certainly export your TDBXReader content into a JSON string, then use our StringToUTF8() function to get a RawJSON variable.

If you can, convert your old code from TDBXReader into native SynDB units.
They are able to return directly UTF-8 JSON, ready to be server for your clients.
I suspect you will have huge performance increase, and much lower resource use.
See http://synopse.info/forum/viewtopic.php?pid=6363#p6363
Just make it a try, and also with multiple threads if you can.

Online

#5 2013-11-20 09:32:03

nirnir
Member
Registered: 2013-11-11
Posts: 66

Re: serving TDBXReader/TclientDataset objects

Thanks,

I will try to migrate my TDBXReader usage to SynDB units .
As I understand TSQLDBConnectionProperties.ExecuteInlined  is thread safe and I need only one instance of TSQLDBConnectionProperties on the server side . Am I right ?

Last edited by nirnir (2013-11-20 09:32:50)

Offline

#6 2013-11-20 10:56:40

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

Re: serving TDBXReader/TclientDataset objects

Exactly.

If you find any problem depending on your backend DB (which database are you using?), please report any issue here.

Online

Board footer

Powered by FluxBB