| xHarbour Reference Documentation > Command Reference |
![]() |
![]() |
![]() |
Writes memory buffers of all used work areas to disk.
COMMIT
The COMMIT command flushes the memory buffers of all used work areas and writes them to disk. Data held in memory for database and index files are permanently written to the respective files. Changes to the data become visible to other processes in a network environment.
It is recommended to call COMMIT before UNLOCK. To flush the memory buffers of a single work area, call function DbCommit().
| See also: | DbCommit(), DbCommitAll(), GO, SKIP |
| Category: | Database commands |
| Source: | rdd\dbcmd.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The examples demonstrates a basic technique for changing a record
// in a shared database:
PROCEDURE Main
LOCAL cFirstName := Space(40)
LOCAL cLastName := Space(50)
USE Address ALIAS Addr SHARED NEW
IF ! NetErr()
SET INDEX TO AddressA, AddressB
ENDIF
CLS
@ 10,5 SAY "Enter first name:" GET cFirstName
@ 11,5 SAY "Enter last name :" GET cLastName
READ
IF .NOT. RLock()
? "Unable to lock record"
ELSE
REPLACE addr->FirstName WITH cFirstName , ;
addr->LastName WITH cLastName
COMMIT
UNLOCK
ENDIF
USE
RETURN
http://www.xHarbour.com