Subject | Re: Dealing with connection loss |
---|---|
Author | |
Post date | 2017-07-10T10:15:49Z |
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 each 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