URL: http://www.firstbasesoftware.com/man/man3/addrec.htm
Last modified: 12 September 1995
Copyright © by FirstBase Software.
[
Index of Contents] [
FirstBase RDBMS Overview]
fb_addrec(db)
fb_database *db;
fb_b_addrec(db)
fb_database *db;
The field structures within the database structure may be updated by using the store(3) routine. Once a record has been completely set up within the array of field descriptors, the fb_addrec routine is called to physically write the fields of data as a single record to the end of the database. This new record is stored as physical record number db->reccnt + 1.
Fb_addrec will perform the following sequence of events:
Note that fb_addrec does not check for unique field values. However, checkfields(3). can be used to enforce this integrity check.
But, fb_addrec does enforce mutual exclusion among any other FirstBase database tools that are running at the same time. In other words, a record added to a database using fb_addrec will properly lock out all other processes before actually adding the record.
Sometimes it is desirable to add many records as fast as possible. Since fb_addrec will lock the database, synchronize the data files, and unlock the database for each record, it can be inefficient. The bulk record processing mechanism can be used in these cases. (See bulkrec(3)).
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, 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.