Article ID: 131888
Article Last Modified on 2/15/2000
=TABLEREVERT()
USE customer
=CURSORSETPROP("Buffering",3)
APPEND BLANK
BEGIN TRANSACTION
ROLLBACK
=TABLEREVERT()
The rule never fires because the ROLLBACK and TABLEREVERT commands clear
the buffer. Because the blank record is never written to the disk file, the
validation rule on cust_id never fires.
=TABLEREVERT()
USE customer
=CURSORSETPROP("Buffering",3)
APPEND BLANK
BEGIN TRANSACTION
ROLLBACK
APPEND BLANK
This behavior occurs because, even though the ROLLBACK command discarded
the current transaction in progress, the record still existed in the
buffer. Optimistic row buffering is enabled, and Visual FoxPro
automatically attempts to write the first appended record to the table when
the record pointer is moved by the second APPEND BLANK command. To prevent
this behavior, a TABLEREVERT() should be issued immediately before or after
a ROLLBACK command.
=TABLEREVERT()
USE customer
=CURSORSETPROP("Buffering",3)
APPEND BLANK
BEGIN TRANSACTION
END TRANSACTION
The transaction doesn't commit to the table, and the record still exists in
the buffer. To prevent this behavior, test for successful execution of a
TABLEUPDATE command prior to issuing the END TRANSACTION command.
=TABLEREVERT()
USE customer
=CURSORSETPROP("Buffering",3)
APPEND BLANK
BEGIN TRANSACTION
=TABLEUPDATE()
END TRANSACTION
An error is received only after the END TRANSACTION command is issued. The
validation rule fires once for the TABLEUPDATE command. The TABLEUPDATE
command fails, but there is no visible indication that the field failed the
validation rule. The return value from the TABLEUPDATE command was not
trapped, and the END TRANSACTION command attempts to write invalid data to
the table.
=TABLEREVERT()
USE customer
=CURSORSETPROP("Buffering",3)
APPEND BLANK
BEGIN TRANSACTION
llDidUpdate = TABLEUPDATE()
IF llDidUpdate
END TRANSACTION
ELSE
lnRecordsDiscarded=TABLEREVERT()
WAIT WINDOW STR(lnRecordsDiscarded) + " Records Discarded"
ROLLBACK
ENDIF
The memory variable (llDidUpdate) contains false (.F.), which indicates
that the TABLEUPDATE command failed. The validation error never appears on
the screen, and a message indicating that one record was discarded appears.
Additional query words: VFoxWin
Keywords: KB131888