Print Thread
ToracleDaset.Unidirectional set to True leads to exception when datasets are in M/D?
#33594 03/13/09 04:35 PM
Joined: Jul 2003
Posts: 112
Fino Mornasco, Como, Italy
L
Member
OP Offline
Member
L
Joined: Jul 2003
Posts: 112
Fino Mornasco, Como, Italy
I have a TRemoteDatamodule (DOA 4.0.7, Delphi 2007) where there are three datasets set in master->detail->detailofdetail relationship. A provider is attached to the master dataset, and details are handled the Datasnap way, embedded as TDatasetFields within the datapacket.
When Unidirectional is set to True to save datasnap server memory, a "Record x not accessible in Unidirectional mode" exception is raised. Looking at the stack trace, it looks detail datasets are refreshed in a way that ends up to call TDataset.First after records are read - and of course that's not possible when the dataset is in Unidirectional mode.
I also see that TDataset.SetUnidirectional() is never called - and it's the method that sets the TDataset.IsUnidirectional property which is checked inside TDataset methods to change TDataset behaviour.
I tried to call it in TOracleDataset.SetUnidirectional(), but that just leads to AVs, probably because with that setting some internal data are not initialized.
Right now the only acceptable workaround I found was to set the master Unidirectional property to True, leaving it to false in details datasets.

Last edited by ldsandon; 03/13/09 04:36 PM.

LDS
Re: ToracleDaset.Unidirectional set to True leads to exception when datasets are in M/D?
ldsandon #33602 03/16/09 11:45 AM
Joined: Aug 1999
Posts: 22,220
Member
Offline
Member
Joined: Aug 1999
Posts: 22,220
UniDirectional can only be used if you can control navigation. It seems that this is not the case here.


Marco Kalter
Allround Automations
Re: ToracleDaset.Unidirectional set to True leads to exception when datasets are in M/D?
Marco Kalter #33615 03/17/09 09:59 AM
Joined: Jul 2003
Posts: 112
Fino Mornasco, Como, Italy
L
Member
OP Offline
Member
L
Joined: Jul 2003
Posts: 112
Fino Mornasco, Como, Italy
AFAIK Unidirectional was introduced by CodeGear to avoid to cache data twice, one on the "source" dataset and one on the "user" dataset, usually TClientDataset, or when cahcing data was useless - dbExpress works that way because TClientDataset caches data.
Because Datasnap can work in a "stateless" mode, it's useless to cache data on the server. It is true that when in M/D mode the detail dataset usually cache a smaller subset of data, but it also true that dataset can't be all set to unidirectional. I don't control navigation, but navigation should happen only forward, because Datasnap should read record that way to build datapackets and send them to che client.


LDS

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.038s Queries: 15 (0.009s) Memory: 2.5072 MB (Peak: 3.0425 MB) Data Comp: Off Server Time: 2024-05-16 18:44:49 UTC
Valid HTML 5 and Valid CSS