Commit

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods >

Commit

Declaration

procedure Commit;

Description

Writes the contents of the record buffer to the current file position. The Replace and PutRecord methods do not physically write a changed record buffer to disk until a record movement function is called (either explicitly or implicitly via a relational move) or the file is closed with a hot record buffer. Use Commit to force an immediate physical write.

 

A record is written by Commit only if the record buffer has changed since being read.

image\tip.gif Under Windows, and on most networks, some sort of disk caching mechanism is usually active. Commit does a low level write to disk which may be intercepted by the Windows buffering subsystem. Apollo has no control over when or how often the disk buffers are flushed so there will not necessarily be any disk activity observed the moment that Commit is called.

Delphi Example

with ApTbl do

begin

 SpeedMode := True; 

 if RLock( RecNo ) then 

 begin  

         Replace( 'NAME', R_CHAR, PChar( 'Homer Simpson' )); 

         Commit;

         Unlock( RecNo ); 

 end 

 else 

         ShowMessage( 'Record lock failed' ); 

 

 SpeedMode := False; 

end;

C++Builder Example

if (ApTbl->RLock( ApTbl->RecNo ))

{

 ApTbl->SpeedMode = TRUE; 

 ApTbl->Replace( "LAST", R_CHAR, PChar( "Simpson" )); 

 ApTbl->Commit();

 ApTbl->Unlock( ApTbl->RecNo ); 

}

else

 ShowMessage( "Record lock failed" ); 

ApTbl->SpeedMode = FALSE;

See Also

Append, AppendBlank, CommitLevel, PutRecord, Replace