Click or drag to resize

TableRevert Function

X#
-- todo --
Discards changes made to a buffered row or a buffered table or cursor and restores the OldVal( ) data for remote cursors and the current disk values for local tables and cursors.
On a network, the data currently on disk might differ from the data on the disk when the table was opened or the cursor was created. Other users on the network might have changed the data after the table was opened or the cursor was created.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION TableRevert(
	lAllRows,
	uArea
) AS LONG CLIPPER
Request Example View Source

Parameters

lAllRows (Optional)
Type: Usual
Determines whether all changes made to the table or cursor are discarded. The following table describes the values for lAllRows.
lAllRowsDescription
False (.F.)If table buffering is enabled, only changes made to the current record in the table or cursor are discarded. (Default)
True (.T.)If table buffering is enabled, changes made to all records are discarded in the table or cursor.
If row buffering is enabled, X# disregards the value of lAllRows, and changes made to the current record in the table or cursor are discarded.
uArea (Optional)
Type: Usual
Specifies the alias of the table or cursor in which the changes are discarded.
Or
Specifies the work area of the table or cursor in which the changes are discarded.

Return Value

Type: Long
Numeric data type. TableRevert( ) returns the number of records for which changes were discarded.
Remarks
TableRevert( ) cannot discard changes made to a table or cursor that does not have row or table buffering enabled. If you issue TableRevert( ) and row or table buffering is not enabled, X# generates an error message. Use CursorSetProp( ) to enable or disable row and table buffering.
Changes are discarded in the table or cursor open in the currently selected work area if TableRevert( ) is issued without the optional uArea arguments.
TableRevert( ) does not return the record pointer to its original position.
TableRevert( ) operates on CursorAdapter objects in the same way as other buffered cursors.
In X# 9.0, you cannot issue the TableRevert( ) function when a TableUpdate( ) is in operation.
Examples
X#
 1Close Databases
 2Set MultiLocks ON  // Must be on for table buffering
 3Set PATH TO (HOME(2) + 'data\')     // Sets path to database
 4Open Database testdata  // Open testdata database
 5Use Customer     // Open customer table
 6= CursorSetProp('Buffering', 5, 'customer')  // Enable table buffering
 7Clear
 8? 'Original cust_id value: '
 9?? cust_id  // Displays current cust_id value
10Replace cust_id    WITH '***'  // Changes field contents
11? 'New cust_id value: '
12?? cust_id  // Displays new cust_id value
13= TableRevert(.T.)  // Discard all table changes
14? 'Reverted cust_id value: '
15?? cust_id  // Displays reverted cust_id value
See Also