#1 2014-09-09 10:47:36

jeans_larghi
Member
Registered: 2014-08-27
Posts: 5

TSQLTableToDataSet(...) method not present on unit mORmotVCL

Hi, I'm using delphi xe3 mormot to Version 1.18.
I can not find the method

TSQLTableToDataSet (Self, SQLTable, form1.client);

in the unit mORmotVCL that I have seen in the examples of the forum.
In which unit can I find this method?
Thank you sincerely.

Offline

#2 2014-09-09 10:51:25

ComingNine
Member
Registered: 2010-07-29
Posts: 294

Re: TSQLTableToDataSet(...) method not present on unit mORmotVCL

It seems that there is no such thing as TSQLTableToDataSet in offcial mORMot:

Administrator@WIN-E1EVP9UU0HK /cygdrive/c/DEV/_Delphi_Lib_/mORMot
$ find ./ -name '*.pas'  -print0 | xargs -0 grep -i --color=always -n TSQLTableToDataSet

Administrator@WIN-E1EVP9UU0HK /cygdrive/c/DEV/_Delphi_Lib_/mORMot
$

Offline

#3 2014-09-09 11:01:16

jeans_larghi
Member
Registered: 2014-08-27
Posts: 5

Re: TSQLTableToDataSet(...) method not present on unit mORmotVCL

I took this method from this link on the forum.
http://synopse.info/forum/viewtopic.php?pid=7452

However, there is a method that can do this?

Offline

#4 2014-09-09 11:12:15

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

Re: TSQLTableToDataSet(...) method not present on unit mORmotVCL

This is all explained in the documentation of the mORMotVCL.pas.

Just use TSynSQLTableDataSet.Create() constructor:

    /// initialize the virtual TDataSet from a TSQLTable
    // - WARNING: the supplied TSQLTable instance shall remain available
    // all the time the returned TSynSQLTableDataSet instance is used, unless
    // the TableShouldBeFreed property is set to true or CreateOwnedTable()
    // constructor is used instead
    // - with non-Unicode version of Delphi, you can set aForceWideString to
    // force the use of WideString fields instead of AnsiString, if needed
    // - the TDataSet will be opened once created
    constructor Create(Owner: TComponent; Table: TSQLTable
      {$ifndef UNICODE}; ForceWideString: boolean=false{$endif}); reintroduce;
    /// initialize the virtual TDataSet owning a TSQLTable
    // - this constructor will set TableShouldBeFreed to TRUE
    // - with non-Unicode version of Delphi, you can set aForceWideString to
    // force the use of WideString fields instead of AnsiString, if needed
    // - the TDataSet will be opened once created
    constructor CreateOwnedTable(Owner: TComponent; Table: TSQLTable

Offline

#5 2014-09-09 11:22:43

jeans_larghi
Member
Registered: 2014-08-27
Posts: 5

Re: TSQLTableToDataSet(...) method not present on unit mORmotVCL

OK thanks

Offline

#6 2014-09-11 10:14:20

jeans_larghi
Member
Registered: 2014-08-27
Posts: 5

Re: TSQLTableToDataSet(...) method not present on unit mORmotVCL

Hi, there is a way for obtain a partial fetching of data to show in grids? Like devexpress "server mode" or Firedac fetchmode = fmOnDemand?
I need to show a lot of records to scroll... What's the best way for optimize memory and quering backend (i'm using firebird)?
Thanks in advance!

Offline

#7 2014-09-11 13:35:33

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

Re: TSQLTableToDataSet(...) method not present on unit mORmotVCL

No, there is no such "partial" mode at grid level.
We better rely on the filtering pattern (just like Google) instead of the paging one, which may be quite expensive, especially when the request is opened on the server, then fetch little by little on the client. Sometimes, it is really a true bad idea.
Try to change the mind, even in UI design, from a RAD/BDE pattern into a MVC/NoSQL scheme.

But you can use the LIMIT clause at request level (in the ORM method, use the WHERE clause for this).

Offline

#8 2014-09-11 14:02:59

jeans_larghi
Member
Registered: 2014-08-27
Posts: 5

Re: TSQLTableToDataSet(...) method not present on unit mORmotVCL

Hi, thank you...
Sorry, I'm new to mormot. Well, ok, I understand you words... :-) I need to re-think the UI "asking" first...
Another question:there is a like "cached update" for retain multirows data change to commit all-in-one system in mormot (or like ApplyUpdate in Firedac) ?
Thank you!

Offline

#9 2014-09-11 16:44:11

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

Re: TSQLTableToDataSet(...) method not present on unit mORmotVCL

There is no "briefcase" model in mORMot yet.

In fact, you have the BATCH feature at hand, not from the UI level, but from the code / ORM level.

It would induce a MVC UI, i.e. bind your UI to objects, then let mORMot persist your objects.

But there is no such direct feature yet, since the TDataSet generated by mORMot are very fast, but still read-only.

Offline

Board footer

Powered by FluxBB