BUG: Reverting to OLDVAL() Causes Error with Table Buffering (157405)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 5.0
  • Microsoft Visual FoxPro for Windows 5.0a
  • Microsoft Visual FoxPro for Windows 6.0

This article was previously published under Q157405

SYMPTOMS

With Table Buffering activated, trying to replace the current value with the value assigned to the OLDVAL() function causes an error, and the table is not updated.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create and Populate a table as follows:
          CREATE TABLE sample ( Field1 C(5) UNIQUE )
          INSERT INTO sample ( Field1 ) VALUES ( "one  " )
          INSERT INTO sample ( Field1 ) VALUES ( "two  " )
          INSERT INTO sample ( Field1 ) VALUES ( "three" )
    						
  2. Set optimistic(5) or pessimistic(4) table buffering on the table as follows:
          SET MULTILOCK ON
          =CURSORSETPROP( "Buffering", 5 )
    						
  3. Change Field1 of the first record as follows:
          GO Top
          REPLACE field1 WITH "four"
    						
  4. Now move the record pointer to confirm the change as follows:
          SKIP
          SKIP -1
    						
  5. Insert OLDVAL() into the record's field, which was just changed, and move the record pointer to submit the change as follows:
          REPLACE field1 WITH OLDVAL( "Field1" )
          SKIP
    						
The "Uniqueness of index FIELD1 is violated" error message appears. You can click Cancel or Ignore to close the error message dialog box.

In order to Update the table again or to close it, you have to Revert the table (TableRevert(.T.)), which updates the table back to before the updates in steps 3 through 5 above.

NOTE: This problem does not exist if you are using Record Locking instead of File Locking.

Modification Type:MajorLast Reviewed:10/16/2002
Keywords:kbBug kbProgramming KB157405