Click or drag to resize

DbCommit Function (Usual)

Flush all pending updates in one work area.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.4a
Syntax
 FUNCTION DbCommit(
	uArea AS USUAL
) AS LOGIC
View Source

Parameters

uArea
Type: Usual
Specifies the work area name or number for a table on which the operation must be performed.

Return Value

Type: Boolean
TRUE if successful; otherwise, FALSE.
Remarks
DBCommit() causes all updates to the work area to be written to disk.   By default, this function operates on the currently selected work area.   It can be made to operate on an unselected work area by specifying it within an aliased expression or by calling the that accepts a workarea parameter (a workarea number or alias ). All updated database and order buffers are written to DOS, and a DOS Commit request is issued for the database file and any index files associated with the work area. DBCommit() performs the same function as the DBCommitAll() function, except that it operates only on the current or aliased work area.
Tip Tip
Shared mode:  DBCommit() makes database updates visible to other processes.
To insure data integrity, issue DBCommit() before an unlock operation.   DBCommit() uses DOS interrupt 21h function 68h to perform the solid-disk write.
It is up to the network software to properly implement this request.  Check with the network software vendor to see if this is supported.
Examples
In this example, DBCommit() is used to force a write to disk after a series of memory variables are assigned to field variables:
X#
 1FUNCTION Start()
 2    LOCAL cName, cAmount
 3    USE sales EXCLUSIVE NEW
 4    cName := Sales->Name
 5    cAmount := Sales->Amount
 6    @ 10, 10 GET cName
 7    @ 11, 10 GET cAmount
 8    READ
 9    IF Updated()
10        IF DBAppend()
11            REPLACE Sales->Name WITH cName
12            REPLACE Sales->Amount WITH cAmount
13            Sales->DBCommit()
14        ENDIF
15    ENDIF
See Also