[progress Communities] [progress Openedge Abl] Forum Post: How To Reliably Detect A...

  • Thread starter Thread starter cverbiest
  • Start date Start date
Status
Not open for further replies.
C

cverbiest

Guest
The connected function is not reliable. It returns false when a database is not connected or when it is connected but a disconnect is pending. My sample code results in sp2k is NOT CONNECTED, trying to connect followed by Error : ** Warning -- database sp2k is already connected. (1012) Is there a way to detect this situation, other than detecting the warning error ? Is there a way to check the database parameters for that db ? If the parameters of the connected sp2k are the same as the sp2k I'm trying to connect to now I don't really mind the connect fails, but if I connect a different sp2k this condition should be fatal. I'd rather not start to maintain my own collection of connected databases with their parameters but currently it's the only solution I see. create a sp2k sports2000 db to run the sample. /* main.p */ def var hlib as handle. connect sp2k -1. run custlib.p persistent set hlib. disconnect sp2k. if connected("sp2k") then do: message "sp2k is connected, ok". end. else do: message "sp2k is NOT CONNECTED, trying to connect" view-as alert-box. connect sp2k -1. end. -- /* custlib.p */ function custinfo returns character (input iCustNum as integer). find customer where customer.custnum = iCustNum no-lock. return substitute("&1 &2", customer.CustNum, customer.Name). end function. see also http://knowledgebase.progress.com/articles/Article/19977?q=connected+function&l=en_US&fs=Search&pn=1 Apparenly connected = true isn't reliable either, see http://knowledgebase.progress.com/articles/Article/P147806?q=connected+function&l=en_US&fs=Search&pn=1 I find it strange that neither PKB mention a bug number.

Continue reading...
 
Status
Not open for further replies.
Back
Top