This example creates a free table named mytable
, and a value of "One" is inserted into the cDigit
field. Optimistic table buffering is enabled with SET MULTILOCKS ON and CURSORSETPROP( ).
A value of "Two" is then inserted into the cDigit
field, and CURVAL( ) and OLDVAL( ) are used to display the original cDigit
values. TABLEUPDATE( ) is used to commit the changes to the table, and CURVAL( ) and OLDVAL( ) are used to display the new cDigit
values. Note that because this is a single user example, CURVAL( ) and OLDVAL( ) return the identical values.
CLOSE DATABASES
CLEAR
CREATE TABLE mytable FREE (cDigit C(10))
* Store original value
INSERT INTO mytable (cDigit) VALUES ("One")
SET MULTILOCKS ON && Allow optimistic table buffering
= CURSORSETPROP("Buffering",5) && Optimistic table buffering on
REPLACE cDigit WITH "Two" && New value
? "Current value: " + CURVAL("cDigit", "mytable")
? "Old value: " + OLDVAL("cDigit", "mytable")
= TABLEUPDATE(.T.) && Commit changes made to table
? "Table changes committed"
? "New current value: " + CURVAL("cDigit", "mytable")
? "New old value: " + OLDVAL("cDigit", "mytable")