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


NAME

bulkrec_begin, bulkrec_end - bulk record process control

SYNOPSIS

#include <firstbase/fb.h>

fb_bulkrec_begin(db, fwait)
fb_database *db;
int fwait;

fb_bulkrec_end(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.

The FirstBase routines fb_addrec and fb_delrec are used to add and delete records one at a time. However, sometimes it is desirable to add and delete many records as fast as possible. The bulk record processing mechanism can be used in these cases.

The bulk processing of records consists of three steps. First, fb_bulkrec_begin is called before any processing. This preliminary call will lock and synchronize the database db, and read the database header.

Then, fb_b_addrec and/or fb_b_delrec are called repeatedly, as needed. Finally, fb_bulkrec_end is used to write the header, synchronize the data files, and unlock the database.

The flag fwait used in the fb_b_bulkrec_begin mechanism controls the behavior of the internal lock request. When fwait is set to FB_WAIT, fb_b_bulkrec_begin will block until the lock is granted, or until the timeout is reached. However, when fwait is FB_NOWAIT, then fb_b_bulkrec_begin will return immediately if the database is locked. In this case, the return status will be FB_ERROR, but the external short int variable cdb_error will be set to FB_LOCKED_ERROR.

CLIENT/SERVER

The fb_bulkrec_begin and fb_bulkrec_end routines will transparently make calls to fb_bulkrec_begin_clnt and fb_bulkrec_end_clnt when the global FirstBase variable cdb_use_rpc is set to one. See fb_clnt_create(3) for more details.

SEE ALSO

opendb(3), addrec(3), delrec(3), database(4).


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