bf_reset()

Purpose

Repositions search for interactive record processing

Syntax (CCOWN)

BOOLEAN bf_reset(BF_HANDLE buffer,short * datarec,int flags);

Syntax (DP4DBAPI)

BOOLEAN dp4_bf_reset(DCONN *dconn,BF_HANDLE buffer,short * datarec,int flags);

Parameters

DCONN * dconn

Handle to database connection

 

BF_HANDLE buffer

Address of buffer

 

short * datarec

Pointer to record variable

 

int flags

Controls the search method

Description

During pick_record() type operations it is occasionally necessary to reposition the search on a record retrieved earlier. For example, when the user presses <Pg Up> after an earlier series of <Pg Dn>s.

To use the bf_reset() function it is necessary to fill in the prime key fields and any non-key fields embedded within these in datarec. bf_reset() can then be called. If a matching record exists within the buffer, it is copied from the buffer unless NO_READ is specified in the flags. Subsequent calls to bf_fetch() will proceed from the appropriate point in the buffer. You can pass NO_FINDLIST in the flags parameter to leave the existing search position as it is, when you want to use the buffer as a cache.

If the record is not found, the rec_fetch_main() function is called to read the record, unless NO_READ is passed in the flags. Furthermore, without NO_FINDLIST passed in the flags, the data in the buffer is discarded.

Return values

The return value is TRUE if the record was found in the buffer or through a call to rec_fetch_main(), FALSE otherwise. The value is also stored in there

Example

See the example for the cache_find() function