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


NAME

fetch - fetch a field from the current record

SYNOPSIS

#include <firstbase/fb.h>

fb_fetch(f, s, db)
fb_field *f;
char *s;
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.

These records are retrieved from the database file and stored into the field structures using getrec(3) or getxrec(3). Once a record has been loaded into the field structures of database db, fb_fetch can be used to copy a field from field descriptor f to a buffer s. This allows s to be walked on without fear of disturbing any data.

If the application program is not designed to run as a client for the FirstBase database server fbserver(8), then it is not always necessary to use fb_fetch since the field is readily available by accessing the char pointer fld in field descriptor f (f->fld).

A macro in the FirstBase header file called FB_FLD(n, db) will produce field n from database db as a char pointer (as long as the application is not based on client/server processing).

However, fb_fetch will also calculate and produce a formula (virtual) field in s. The FB_FLD macro will not accomplish this formula retrieval.

Also note that in the case of FB_BINARY fields, the entire field is ALWAYS fixed length. So, it is up to the programmer using fb_fetch(3) to make sure that s, the object being written into, is the same byte size as the field length in the database dictionary.

CLIENT/SERVER

The fb_fetch routine will transparently call fb_fetch_clnt when the global FirstBase variable cdb_use_rpc is set to one. See fb_clnt_create(3) for more details.

SEE ALSO

getrec(3), opendb(3), database(4).

DIAGNOSTICS

Fb_fetch will return either FB_AOK or FB_ERROR as a return status.


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