URL: http://www.firstbasesoftware.com/man/man3/firstxrec.htm
Last modified: 12 September 1995
Copyright © by FirstBase Software.
[ Index of Contents] [ FirstBase RDBMS Overview]


NAME

firstxrec, lastxrec, firstovxrec, lastovxrec - load first/last indexed record

SYNOPSIS

#include <firstbase/fb.h>

fb_firstxrec(db)
fb_database *db;

fb_lastxrec(db)
fb_database *db;

fb_firstovxrec(db)
fb_database *db;

fb_lastovxrec(db)
fb_database *db;

fb_currentxrec(db)
fb_database *db;

DESCRIPTION

As explained in the database(4) manual page, a database structure contains all of the elements needed for an entire database, including an array of field structures, all file names and descriptors, and index information. Altogether, the array of field structures can hold one complete record.

Fb_firstxrec attempts to load the first indexed record into database db. Fb_lastxrec attempts to load the last indexed record into database db. These two calls are applicable to any kind of FirstBase index.

Note: the following discussion concerns normal (flat) FirstBase indexes and does not apply to btree indexes. See btree(4) for more details on the FirstBase Btree+ indexes.

As noted in the index(4) manual page, autoindexes can have a section of index entries that are not sorted. This index overflow area can still be accessed. Fb_firstovxrec attempts to load the first overflow record from the index into database db. Fb_lastovxrec attempts to load the last overflow record into database db.

Note that nextxrec(3) and prevxrec(3) do not care about the boundary between sorted and overflow index records. For example, an fb_nextxrec after an fb_lastxrec is equivalent to an fb_firstovxrec.

Once a record number is retrieved from the index, each of these routines call getrec(3) to load the record into the database structure.

The physical position number of the index entry, the index record number, is stored in the database structure db->bsrec for each of these routines. If db->bsrec is greater than db->bsend, the returned record's key is stored in the overflow area of the index, otherwise it is stored in the binary searchable area.

The fb_currentxrec mechanism will load the current index record.

CLIENT/SERVER

The fb_firstxrec and fb_lastxrec routines will transparently call fb_firstxrec_clnt and fb_lastxrec_clnt when the global FirstBase variable cdb_use_rpc is set to one. See fb_clnt_create(3) for more details.

SEE ALSO

getxrec(3), getrec(3), nextxrec(3), opendb(3), database(4), index(4).

DIAGNOSTICS

These routines will return FB_AOK on a successful call, and FB_ERROR when the record could not be found or loaded.


URL: http://www.firstbasesoftware.com/man/man3/firstxrec.htm
Last modified: 12 September 1995
Copyright © by FirstBase Software.
[ Index of Contents] [ FirstBase RDBMS Overview]