Command COMMIT Foundation

Writes contents of file buffers from all work areas back into the files.

Syntax
COMMIT
Description

The command COMMIT causes the contents all open file buffers in all work areas (buffers for database and index files) to be written back into the respective files. Data changed in memory are thus permanently saved on the hard disk.

The functional equivalent of the command COMMIT is the function DbCommitAll(). To write the contents of a file buffer from a single work area back into the file, the function DbCommit() is used.

Examples
COMMIT
// In the example, the data for a record is 
// entered and changed in memory variables. After 
// it is changed, it is next copied into the file 
// buffer using REPLACE. Finally, it is written into 
// the file with COMMIT. 

PROCEDURE Main 
   LOCAL cPartNo , cPart 

   USE Part INDEX PartA, PartB ALIAS Pt NEW 
   cPartNo := Pt->PartNo 
   cPart   := Pt->Part 

   CLS 
   @ 10,5 SAY "Part number     :" GET cPartNo 
   @ 11,5 SAY "Part designation:" GET cPart 
   READ 

   IF .NOT. Empty( cPartNo + cPart ) 
      REPLACE pt->PartNo   WITH cPartNo  , ; 
              pt->Part     WITH cPart 
      COMMIT 
   ENDIF 

   CLOSE Pt 
RETURN 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.