#1 2017-01-23 05:58:46

htits
Member
Registered: 2014-12-27
Posts: 10

ToClientDataSet function can chang the JSON DATA to TFDMEMTable?

8.1.9. TDataset and SynDB
Since our SynDB.pas unit does not rely on the Delphi's DB.pas unit, its result sets do not inherit from the TDataset.
As a benefit, those result sets will be much faster, when accessed from your object code. But as a drawback, you won't be able to use them in your regular VCL applications.
In order to easily use the SynDB.pas unit with VCL components, you can create TDataSet results sets from any SynDB query. You have access to two kind of optimized TDataSet result sets:
TDataSet class
Operation
Unit
Remark
TClientDataSet
read write
SynDBMidasVCL.pas
Slow due to memory copy
TSynSQLStatementDataSet
read only
SynDBVCL.pas
Fast due to direct mapping

You can therefore assign the result of a SynDB request to any TDataSource, as such for our fast TSynSQLStatementDataSet read/only storage: ds1.DataSet.Free; // release previous TDataSet ds1.DataSet := ToDataSet(ds1,aProps.Execute('select * from people',[]));
or for a TClientDataSet kind of in-memory storage: ds1.DataSet.Free; // release previous TDataSet ds1.DataSet := ToClientDataSet(ds1,aProps.Execute('select * from people',[]));
See sample

Offline

#2 2017-01-23 08:37:41

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

Re: ToClientDataSet function can chang the JSON DATA to TFDMEMTable?

???
You just copied the documentation
https://synopse.info/files/html/Synopse … l#TITL_134
???

There is no TFDMemTable direct support yet.
But doesn't FireDac table support JSON directly?

Offline

#3 2017-01-23 11:05:37

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

Re: ToClientDataSet function can chang the JSON DATA to TFDMEMTable?

I've added two new GetDBFieldDef and GetDBFieldValue functions to ease filling of any TDataSet from a TSQLTable content.
See https://synopse.info/fossil/info/1b80f48d4e

You could use them to fill a TFDMemTable.
Start your code from unit mORMotMidasVCL, which fills a TCLientDataSet.
Then you are welcome sharing your result unit, so that we may add it to the framework!
(use pastebin or github, please do not paste the unit in here).

Offline

#4 2017-01-23 15:38:25

htits
Member
Registered: 2014-12-27
Posts: 10

Re: ToClientDataSet function can chang the JSON DATA to TFDMEMTable?

Thinks , ab!
It's that I want to Know.

Offline

Board footer

Powered by FluxBB