Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 2 of 2 total |
Sanity check.... |
Mon, Jun 12 2023 3:24 PM | Permanent Link |
Ian Branch | Hi Team,
Does anybody see any issue with this construct?? {code} try // while true do begin // if TEDBEngineSessionManager(dmDB.DBS1.Handle).TryLock(1) then begin // TEDBEngineSessionManager(dmDB.DBS1.Handle).Unlock; // { Session is not locked and is safe for you to use } try // tqServerSessions.Close; tqServerSessions.ExecSQL; // Break; // except // Delay for the specified amount of time Sleep(250); // end; // end else // Delay for the specified amount of time Sleep(250); // end; // except on E: Exception do ShowMessage('An unknown or unexpected error has occurred.'); end; {code} I think the initali try-except-end is redundant. Anything else? Regards & TIA, Ian |
Tue, Jun 13 2023 2:29 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Ian
Personal view If you mean << if TEDBEngineSessionManager(dmDB.DBS1.Handle).TryLock(1) then begin // TEDBEngineSessionManager(dmDB.DBS1.Handle).Unlock; // { Session is not locked and is safe for you to use }>> then yes - if it fails here it will also fail when you try and run the script I'd also suggest << tqServerSessions.Close; tqServerSessions.ExecSQL; >> becomes << tqServerSessions.ExecSQL; tqServerSessions.Close; >> or if you need an OUT parameter later on that you release it at some point elsewhere and I just hate << while true do begin >> use a variable and set as needed and allow the loop to terminate gracefully Roy Lambert |
This web page was last updated on Saturday, May 4, 2024 at 09:18 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |