Difference between revisions of "TABLEREVERT()"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
Yvonne.milne (Talk | contribs) |
||
Line 31: | Line 31: | ||
? "Fieldstate at start: " + getfldstate("customerid") | ? "Fieldstate at start: " + getfldstate("customerid") | ||
− | replace customerid WITH " | + | replace customerid WITH "LIANJ" |
// Alter in another session | // Alter in another session | ||
− | + | // update southwind!customers set customerid = 'MULTI' where recno() = 1 | |
? "Someone else just updated the record!" | ? "Someone else just updated the record!" | ||
? "New customerid value: " + customerid | ? "New customerid value: " + customerid | ||
Line 47: | Line 47: | ||
? "Fieldstate after revert: " + getfldstate("customerid") | ? "Fieldstate after revert: " + getfldstate("customerid") | ||
− | replace customerid WITH " | + | replace customerid WITH "LIANJ" |
? "New customerid value: " + customerid | ? "New customerid value: " + customerid | ||
tableupdate(.T.) | tableupdate(.T.) |
Latest revision as of 13:39, 19 May 2014
Contents
Purpose
Function to discard changes and restore OLDVAL() or currect disk data during buffered processing
Syntax
TABLEREVERT(<expL> | <expN> [, <workarea | alias>])
See Also
CURSORGETPROP(), CURSORSETPROP(), CURVAL(), GETFLDSTATE(), OLDVAL(), TABLEUPDATE(), SETFLDSTATE()
Description
The TABLEREVERT() function is used to discard changes and restore OLDVAL() or currect disk data during buffered processing. If <expL> is .T. or <expN> 1 (True), TABLEREVERT() applies to all rows. If <expL> is .F. or <expN> 0 (False), TABLEREVERT() only applies to the current row.
If the optional <workarea | alias> is specified, then the function will operate in the required location.
Example
close databases clear set exclusive off open database southwind use customers // Set to known value before start replace customerid with "ALFKI" cursorsetprop("Buffering", 5, "customers") messagebox("Buffering set to " +etos(cursorgetprop("Buffering"))) ? "Original customerid value: " + customerid ? "Curval(): " + curval("customerid") ? "Oldval(): " + oldval("customerid") ? "Fieldstate at start: " + getfldstate("customerid") replace customerid WITH "LIANJ" // Alter in another session // update southwind!customers set customerid = 'MULTI' where recno() = 1 ? "Someone else just updated the record!" ? "New customerid value: " + customerid ? "Curval(): " + curval("customerid") ? "Oldval(): " + oldval("customerid") ? "Fieldstate after replace: " + getfldstate("customerid") tablerevert(.T.) ? "Reverted customerid value: " + customerid ? "Curval(): " + curval("customerid") ? "Oldval(): " + oldval("customerid") ? "Fieldstate after revert: " + getfldstate("customerid") replace customerid WITH "LIANJ" ? "New customerid value: " + customerid tableupdate(.T.) ? "Updated customerid value: " + customerid ? "Curval(): " + curval("customerid") ? "Oldval(): " + oldval("customerid") ? "Fieldstate after replace and update: " + getfldstate("customerid") ?