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


NAME

put_autoindex, set_autoindex - reset and store autoindex entries

SYNOPSIS

#include <firstbase/fb.h>

fb_put_autoindex(db)
fb_database *db;

fb_set_autoindex(db)
fb_database *db;

DESCRIPTION

Automatic indexes within FirstBase are either defined in the database dictionary (ddict(5)) for simple autoindexes or via the autoindex file (autoindex(5)) for complex indexes. The fb_put_autoindex and fb_set_autoindex mechanisms handle index maintenance for an open database.

These autoindex mechanisms are only needed when an existing record is retrieved (fb_getrec or fb_getxrec), a key field is modified, and then the record is replaced (fb_putrec). When new records are added (fb_addrec) or existing records are deleted (fb_delrec), these autoindex mechanisms are not needed.

Generally, the scenario for use of these autoindex maintenance routines is:

   char *key;
   fb_database *dp;

   fb_getxrec(key, dp);
   fb_set_autoindex(dp);
   ...
   /* change values in key fields */
   ...
   fb_putrec(dp->rec, dp);
   fb_put_autoindex(dp);

In this pseudo code, a record is retrieved using fb_getxrec. Then fb_set_autoindex is called to save the field values that are used in the defined autoindexes. After this, the values in the fields can be changed and the record is written to the database using fb_putrec. Finally, fb_put_autoindex is called to synchronize all automatic indexes.

CLIENT/SERVER

The fb_put_autoindex and fb_set_autoindex routines will transparently call the fb_put_autoindex_clnt and fb_set_autoindex_clnt mechanisms when the global FirstBase variable cdb_use_rpc is set to one. See fb_clnt_create(3) for more details.

SEE ALSO

btree(4), openidx(3).

DIAGNOSTICS

Fb_put_autoindex and fb_set_autoindex will return the error code FB_ERROR if any part fails. An FB_AOK signal is returned on correct completion.


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