• Antelope Release 5.10 Linux CentOS release 7.6.1810 (Core) 3.10.0 2020-05-12

 

NAME

dblookup - lookup indexes from ascii names

SYNOPSIS

#include "db.h"

Dbptr dblookup( Dbptr db,
		char *database_name,
		char *table_name,
		char *field_name,
		char *record_name  ) ;

DESCRIPTION

dblookup is a means for translating from a symbolic name (the name of a database, table, field or record, e.g. wfdisc.dir) to the integer id in the database pointer. You specify an input database pointer and one or more names. To find id's for later parameters like field_name, one must first know the id's for the previous parameters. For example, to find the id for a table, one must know the database. Hence, the previous id's must be specified, either in the database pointer db, or by name. Names which are not specified explicitly in the call are represented by zero. For example, given a database pointer which specifies a particular database, to find the database pointer which specifies the "dir" field in the "wfdisc" table, use the following:
	db = dblookup ( db, 0, "wfdisc", "dir", 0 ) ;

If the specified database is not found among the open databases, dblookup *does not* attempt to open it: you must use dbopen to open a database.

Since records have no corresponding names, the record_name parameter is not very useful. However, you can specify "dbALL", "dbSCRATCH" or "dbNULL" in this position. Alternatively, dblookup searches for the first record in which the specified field has the specified (string) value, starting with record zero.

RETURN VALUES

When dblookup fails, it returns dbINVALID in the corresponding position of the returned db pointer. It looks up the pointer values in the order: database, table, field, record. The value dbINVALID is returned for the first place failure occurs. I.e., for this call:

db = dblookup(db, 0, "site", "time", 0) ;

the returned db.field would be dbINVALID, while db.table would identify the site table; db.database and db.record would retain their original input values.

LIBRARY

$(DBLIBS)

SEE ALSO

dbintro(3)

AUTHOR

Daniel Quinlan
Printer icon