URL: http://www.firstbasesoftware.com/man/man3/bulkrec.htm
Last modified: 12 September 1995
Copyright © by FirstBase Software.
[
Index of Contents] [
FirstBase RDBMS Overview]
fb_bulkrec_begin(db, fwait)
fb_database *db;
int fwait;
fb_bulkrec_end(db)
fb_database *db;
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.