User Tools

Site Tools


restorebuffer_restore_a_previously_saved_record_buffer_.htm
Navigation:  ABC Library Reference > FileManager > FileManager Methods >====== RestoreBuffer (restore a previously saved record buffer) C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

RestoreBuffer( buffer id [, restore] )

blk2blue.jpg

RestoreBuffer Restores previously saved record buffer contents.
buffer id An integer constant, variable, EQUATE, or expression that identifies the buffer contents to restore–this is a value returned by the SaveBuffer method.
restore An integer constant, variable, EQUATE, or expression that indicates whether to restore the managed file's buffer contents, or simply DISPOSE of the specified buffer. A value of one (1 or True) updates the file's Buffer; a value of zero (0 or False) does not update the file's Buffer. If omitted, restore defaults to True.

The RestoreBuffer method restores record buffer contents to the managed file's record buffer (the Buffer property). RestoreBuffer restores values previously saved by the SaveBuffer method, including MEMO fields.

Implementation:

The RestoreBuffer method releases memory allocated by the SaveBuffer method. Therefore, to prevent a memory leak, each call to SaveBuffer should be paired with a corresponding call to RestoreBuffer.

The RestoreBuffer method retrieves and DISPOSEs the specified contents from the Buffers property.

Example:

FileManager.RestoreFile PROCEDURE(*USHORT Id)

CODE

IF ~SELF.UseFile()

 SELF.Saved.Id = Id

 GET(SELF.Saved,SELF.Saved.Id)

 ASSERT(~ERRORCODE())

 IF SELF.Saved.Key &= NULL

  RESET(SELF.File,SELF.Saved.Pos)

 ELSE

  RESET(SELF.Saved.Key,SELF.Saved.Pos)

 END

 IF SELF.Saved.WHeld

  HOLD(SELF.File)

 END

 IF SELF.Saved.WWatch

  WATCH(SELF.File)

 END

 NEXT(SELF.File)

 SELF.RestoreBuffer(SELF.Saved.Buffer)

 DELETE(SELF.Saved)

 Id = 0

END

See Also:     Buffer, Buffers, SaveBuffer

restorebuffer_restore_a_previously_saved_record_buffer_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1