LOCKTIMEOUT function bounds

fracchefracche Member Posts: 2
Hi to all.
I'm experiencing locking issues with a procedure so I tried to use LOCKTIMEOUT(FALSE) to avoid the client error to be shown at the user.
Nevertheless, the message is showing. I would like to understand more about this function: Microsoft Docs says: "When the C/AL code has finished running, the default setting is used again." so I expected it to be called just once for an entire session but, because the message was still showing, I had to put it randomly in other code parts while debugging the procedure (before some FIND('-') or FINDSET).
Does anyone knows how this function is supposed to be used?
NAV version is 2017 CU00. Timeout duration parameter is 30 sec (default value).
Thanks in advance.
Francesco

Best Answer

  • fracchefracche Member Posts: 2
    edited 2018-08-03 Answer ✓
    Hi, I figured it out on my own after some testing: the value is set to FALSE until COMMIT (end of SQL transaction or C/AL code COMMIT instruction) is executed. I had to put it in many places because there was plenty of COMMIT instructions in the original code.
    Thanks anyway.

Answers

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    fracche wrote: »
    Microsoft Docs says: "When the C/AL code has finished running, the default setting is used again"
    I would interpret this as the LOCKTIMEOUT is valid for a single SQL server call only, not the entire session.
    SETFILTER(...)
    LOCKTIMEOUT(FALSE);
    FINDSET; // LOCKTIMEOUT applies only to this line
    FINDSET;
    
    But can't say for sure, personally haven't used the LOCKTIMEOUT yet.


    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • fracchefracche Member Posts: 2
    edited 2018-08-03 Answer ✓
    Hi, I figured it out on my own after some testing: the value is set to FALSE until COMMIT (end of SQL transaction or C/AL code COMMIT instruction) is executed. I had to put it in many places because there was plenty of COMMIT instructions in the original code.
    Thanks anyway.
Sign In or Register to comment.