Manual Pages for UNIX Darwin command on man dbm_nextkey
MyWebUniversity

Manual Pages for UNIX Darwin command on man dbm_nextkey

DBM(3) BSD Library Functions Manual DBM(3)

NAME

ddbbmmcclleeaarreerrrr, ddbbmmcclloossee, ddbbmmddeelleettee, ddbbmmddiirrffnnoo, ddbbmmeerrrroorr, ddbbmmffeettcchh,

ddbbmmffiirrssttkkeeyy, ddbbmmnneexxttkkeeyy, ddbbmmooppeenn, ddbbmmssttoorree - database access func-

tions

SYNOPSIS

##iinncclluuddee <>

##iinncclluuddee <>

DBM * ddbbmmooppeenn(const char *base, int flags, int mode); void ddbbmmcclloossee(DBM *db); int ddbbmmssttoorree(DBM *db, datum key, datum data, int flags); datum ddbbmmffeettcchh(DBM *db, datum key); int ddbbmmddeelleettee(DBM *db, datum key); datum ddbbmmffiirrssttkkeeyy(DBM *db); datum ddbbmmnneexxttkkeeyy(DBM *db); int ddbbmmeerrrroorr(DBM *db); int ddbbmmcclleeaarreerrrr(DBM *db); int ddbbmmddiirrffnnoo(DBM *db);

DESCRIPTION

Database access functions. These functions are implemented using dbopen(3) with a hash(3) database. datum is declared in : typedef struct { char *dptr; int dsize; } datum; The ddbbmmooppeenn(base, flags, mode) function opens or creates a database. The base argument is the basename of the file containing the database; the actual database has a .db suffix. I.e., if base is "/home/me/mystuff" then the actual database is in the file /home/me/mystuff.db. The flags and mode arguments are passed to open(2). (ORDWR | OCREAT) is a typical value for flags; 0660 is a typical value for mode. OWRONLY is not allowed in flags. The pointer returned by ddbbmmooppeenn() identifies the database and is the db argument to the other functions. The ddbbmmooppeenn() function returns NULL and sets errno if there were any errors. The ddbbmmcclloossee(db) function closes the database. The ddbbmmcclloossee() function normally returns zero. The ddbbmmssttoorree(db, key, data, flags) function inserts or replaces an entry in the database. The flags argument is either DBMINSERT or DBMREPLACE. If flags is DBMINSERT and the database already contains an entry for key, that entry is not replaced. Otherwise the entry is replaced or inserted. The ddbbmmssttoorree() function normally returns zero but returns 1 if the entry could not be inserted (because flags is DBMINSERT, and an

entry with key already exists) or returns -1 and sets errno if there were

any errors. The ddbbmmffeettcchh(db, key) function returns NULL or the data corresponding to key. The ddbbmmddeelleettee(db, key) function deletes the entry for key. The ddbbmmddeelleettee() function normally returns zero but returns 1 if there was no

entry with key in the database or returns -1 and sets errno if there were

any errors. The ddbbmmffiirrssttkkeeyy(db) function returns the first key in the database. The ddbbmmnneexxttkkeeyy(db) function returns subsequent keys. The ddbbffiirrssttkkeeyy() function must be called before ddbbmmnneexxttkkeeyy(). The order in which keys are returned is unspecified and may appear random. The ddbbmmnneexxttkkeeyy() function returns NULL after all keys have been returned. The ddbbmmeerrrroorr(db) function returns the errno value of the most recent error. The ddbbmmcclleeaarreerrrr(db) function resets this value to 0 and returns 0. The ddbbmmddiirrffnnoo(db) function returns the file descriptor to the database.

SEE ALSO

open(2), dbopen(3), hash(3) STANDARDS These functions (except ddbbmmddiirrffnnoo()) are included in the Version 2 of the Single UNIX Specification (``SUSv2''). BSD July 7, 1999 BSD




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™