Subject | Re: [IBO] Re: Dealing with connection loss |
---|---|
Author | Robert Martin |
Post date | 2017-07-10T20:57:34Z |
Hi Danny
Thanks for the pointer, will check out ConnectionWasLost. Luckily for me the app in this instance only has one main query that displays data in a grid, other SQLs are inserts etc so they won't be an issue for me. The only thing I need to deal with is people plugging / unplugging laptops from a network, so its unlikely they would do so in the split second after editing a record.
btw I had the same dream. I wanted to put opening queries in a thread so that the main VCL thread would not 'freeze' while opening a query and then pass control back to the main thread. Seems now that the FB client supports multithreading it might be more do able :)
Cheers
Rob
Thanks for the pointer, will check out ConnectionWasLost. Luckily for me the app in this instance only has one main query that displays data in a grid, other SQLs are inserts etc so they won't be an issue for me. The only thing I need to deal with is people plugging / unplugging laptops from a network, so its unlikely they would do so in the split second after editing a record.
btw I had the same dream. I wanted to put opening queries in a thread so that the main VCL thread would not 'freeze' while opening a query and then pass control back to the main thread. Seems now that the FB client supports multithreading it might be more do able :)
Cheers
Rob
On 10/07/2017 10:15 PM, danymarmur@... [IBObjects] wrote:
Jason has put in some neat functions for this (from the top of my head the TIB_Connection.ConnectionWasLost flag is surely neat).
There should be reconnection code at least in the service samples, maybe in other places too.
It was a very long time since i did this, and in a very complex project. FWIW i had troubles when the discovery of the lost connection happened deep inside some TDataset compatible over-complex controls. I was not able to restore the state of everything 100%. That is a problem similar to what you are already describing.
For a VCL app to do this neatly and as smoothly as, well a webpage, you would need to design you code very much like if you designed a component with some published properties where each single one can be toggled at any point. I am not very clear... hmm... i do not remeber specifically if you have to reprepare SQL or just open them. in any case if SQLs are dependent on eac h other it can be tricky just to loop through them all and just open them.
As an aside, i did so that after a small number of attempts (maybe just 3-5) i put up a dialog where the user could choose to try again or "disconnect". Because the client dll does not allow for message-processing during it's work. Reminds me of a dream i had to connect in a thread and give the whole DM over to the main thread when sucessful so users could abort the connection process.
Ah, i'm disgressing. HTH, good luck.
/D