paul.coshott Posted April 15, 2019 Share Posted April 15, 2019 Hi All, What it the correct way to execute multiple queries one after another? The queries are being run server side, so I assume I can expect synchronous behaviour? Can I do: qryStaff.Close; qryStaff.ParamByName('StaffId').AsInteger := 1; qryStaff.Open; qryStaffJobs.Close; qryStaffJobs.ParamByName('JobListId').AsInteger := qryStaff.FieldByName('JobListId').AsInteger; qryStaffJobs.Open; The second query depends on a value from the first query. Is this ok? Or do I need to open the second query in the OnAfterOpen event of the first query? I am using Delphi 10.2, uniGUI trial 1.7 and Firebird 3. Thanks for any help, Paul Link to comment Share on other sites More sharing options...
Ron Posted April 15, 2019 Share Posted April 15, 2019 Synchronization involves the interaction between client and server, so when you are operating on only one side there is no such problem. The only question in this case is if your db access methods are blocking, and if they are they will be executed sequentially as usual. One way to try this out is to simply test it and see what happens. Link to comment Share on other sites More sharing options...
paul.coshott Posted April 15, 2019 Author Share Posted April 15, 2019 Hi Ron, Thanks for the info. Can I ask what you mean by blocking? And I'm not sure the test would tell me much, as I'm running it locally, so I may not see any problems. Cheers, Paul Link to comment Share on other sites More sharing options...
Volk65 Posted April 15, 2019 Share Posted April 15, 2019 In the first DataSet create the AfterScroll event, which is open the second (child) DataSet. Link to comment Share on other sites More sharing options...
Ron Posted April 18, 2019 Share Posted April 18, 2019 "Blocking" refers to whether the function/method returns only after execution is completed, or if it e.g. spawns a thread to do the job and then returns immediately without you knowing if anything at all has been done or not. In case of non-blocking components, you typically have to check a status event to see how things go, or you can hook into some finishing event if that exists. I guess most db-components are blocking, and this should be easy to determine from their documentation. To test things out, just get a free test server and run some tests. You can also do some checking to see if previous changes have been applied, before each new posting, for the most critical sections. Just to be sure. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now