albertovesx Posted February 8, 2022 Share Posted February 8, 2022 Hi, is it thread safe to add a standard Delphi Unit to use database manipulation functions with object from mainmodule? for example: function getInformation(DataSet: TuniQuery): Boolean; begin // do something end; //call it like this if getInformation(MainModule.qryPerson) then // do something Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted February 9, 2022 Share Posted February 9, 2022 On 2/8/2022 at 8:39 PM, albertovesx said: Hi, is it thread safe to add a standard Delphi Unit to use database manipulation functions with object from mainmodule? for example: function getInformation(DataSet: TuniQuery): Boolean; begin // do something end; //call it like this if getInformation(MainModule.qryPerson) then // do something Good question. IMHO, No it's not safe. A classical vcl Unit, is like a static model, witch will be view by all sessions. How can you garantee that a DataSet sended by a session, matches the correct session ? So, for this reason it's desirable and advisable to use UniDataModule. Even better : you can create a class on a UniDataModule and work with object on UniFrame or UniForm. Obj.myDataSet:=Query1; If obj.fct_GetInformation then... Related topic: http://forums.unigui.com/index.php?/topic/11974-global-variable/&do=findComment&comment=63879 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.