User Tools

Site Tools


buffer_set_record_paging_.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== BUFFER (set record paging) ====== Previous pageReturn to chapter overviewNext page

 

BUFFER( entity [, pagesize ] [, behind ] [, ahead ] [, timeout ] )

blk2blue.jpg

BUFFER Specifies FILE or VIEW paging.
entity The label of a FILE or VIEW structure.
pagesize An integer constant or variable which specifies the number of records in a single “page” of records (PROP:FetchSize). If omitted, the default value is one (1).
behind An integer constant or variable which specifies the number of “pages” of records to store after they've been read. If omitted, the default value is zero (0).
ahead An integer constant or variable which specifies the number of additional “pages” of records to read ahead of the currently displayed page. If omitted, the default value is zero (0).
timeout An integer constant or variable which specifies the number of seconds the buffered records are considered not to be obsolete in a network environment. If omitted, the default value is zero (0), which indicates no time limit.

The BUFFER statement specifies automatic record set buffering for the specified entity by the file driver. If there are multiple file drivers used by the files in a VIEW entity, BUFFER is ignored.

The number of records in a single “page” of records is specified by the pagesize parameter. This is also the number of records fetched in a single call to the database. The ahead parameter specifies asynchronous read-ahead buffering of a number of pages, while the behind parameter saves pages of already read records.

The records in the buffer must be contiguous. Therefore, issuing a SET to an area of the entity that is not currently in the buffer, or changing the sort order or the FILTER condition of a VIEW, will clear the buffers. The buffers remain active until the entity is closed, or a FLUSH statement is issued. The buffers will reflect the results of ADD, PUT, or DELETE statements, however, this may cause an implicit flush if a PUT changes key components or an ADD adds a record that is not within the current contiguous set of buffered records.

BUFFER allows the performance of “browse” type procedures to be virtually instantaneous when displaying pages of records already read, due to use of the ahead and behind parameters. BUFFER can also optimize performance when the file driver is a Client/Server back-end database engine (usually SQL-based), since the file driver can then optimize the calls made to the back-end database for minimum network traffic.

BUFFER is not supported by all file drivers–see the relevant file driver's documentation for further information.

Example:

CODE  

OPEN(MyView)

BUFFER(MyView,10,5,2,300)  !10 records per page, 5 pages behind and 2 read-ahead,

                          !with a 5 minute timeout

CODE  

OPEN(MyFile)

BUFFER(MyFile,10,5,2,300) !10 records per page, 5 pages behind and 2 read-ahead,

                          !with a 5 minute timeout

See Also:

FLUSH

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