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.10
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 overload 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#
FUNCTION Start()
        LOCAL cName, cAmount
        USE sales EXCLUSIVE NEW
        cName := Sales->Name
        cAmount := Sales->Amount
        @ 10, 10 GET cName
        @ 11, 10 GET cAmount
        READ
        IF Updated()
                IF DBAppend()
                        REPLACE Sales->Name WITH cName
                        REPLACE Sales->Amount WITH cAmount
                        Sales->DBCommit()
                ENDIF
        ENDIF
See Also