PRB: ISRLOCKED() and ISFLOCKED() Return Incorrect Values

ID: Q188064


The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 5.0, 5.0a


SYMPTOMS

When an instance of Visual FoxPro locks a record or a table, calling the ISRLOCKED() or ISFLOCKED() functions on another computer or another instance of Visual FoxPro returns false.


RESOLUTION

Test the lock status using RLOCK() or FLOCK() instead. ISRLOCKED() and ISFLOCKED() only indicate whether the record or file is locked by the instance of Visual FoxPro from which they are called. If these functions were to test for the record and file locks of other users, the lock status could quickly change. This would make the information returned by ISRLOCKED() and ISFLOCKED unreliable.


STATUS

This behavior is by design.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Save the following code in a program and run the program:
    
          *-- Code begins here.
          CREATE TABLE locktest (field1 C(10))
          CLOSE DATA
          USE locktest SHARED
          INSERT INTO locktest (field1) VALUES ("A test")
          GOTO 1
          =RLOCK()
          *-- Code ends here. 


  2. On another computer or in another instance of Visual FoxPro, save the following code in a program and run the program:
    
          *-- Code begins here.
          USE locktest SHARED
          GOTO 1
          IF ISRLOCKED()
              WAIT WINDOW "Record is locked."
          ELSE
              WAIT WINDOW "Record is not locked."
              =RLOCK() && Should get the "Attempting to lock..." in status bar
          ENDIF
          *-- Code ends here. 
    If you run the program from another computer, please map a drive to the first computer containing the Locktest table.


After you run the second program the Wait Window appears. Press any key and the "Attempting to lock..." message appears in the status bar.


REFERENCES

© Microsoft Corporation 1998, All Rights Reserved.
Contributions by Mike Stewart, Microsoft Corporation

Additional query words: kbDSupport kbDSE vfoxwin

Keywords :
Version : WINDOWS:5.0,5.0a
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: December 10, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.