URL: http://www.firstbasesoftware.com/man/man3/foreach.htm
Last modified: 12 September 1995
Copyright © by FirstBase Software.
[
Index of Contents] [
FirstBase RDBMS Overview]
fb_foreach(db, f)
fb_database *db;
int (*f)();
fb_forxeach(db, f)
fb_database *db;
int (*f)();
fb_blockeach(db, f)
fb_database *db;
int (*f)();
The idea is to create a separate function, f, that takes exactly one argument -- an fb_database pointer. This function must return the FB_AOK signal on correct completion, and FB_ERROR on an incorrect completion.
The function f is then passed into foreach, forxeach or blockeach as an argument. These routines do the actual looping through the database. The only difference between foreach and forxeach is which records are accessed: foreach will process the entire database whereas forxeach will follow the database index loaded into the db structure, calling f only for those records that the index references.
Blockeach is essentially the same as foreach, but record blocking is used to provide extremely fast throughput. However, blockeach does not follow the database map, meaning the "record number" is actually a positional number. If the database is clean (as in dbclean(1)) this number will be the same as the true (database map) record number. Alternately, in many cases the application program does not need the true record number. If blockeach can be used within these constraints, record processing will be much faster.