Click or drag to resize

DbCommit Function

X#
Flush all pending updates in one work area.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION DbCommit() AS LOGIC
Request Example View Source

Return Value

Type: Logic
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#
 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