dbm_nextkey() — Get next key in database
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4.2 |
both |
Format
#define _XOPEN_SOURCE_EXTENDED 1
#include <ndbm.h>
datum dbm_nextkey(DBM * db);
General description
for (key = dbm_firstkey(db); key.dptr !=NULL; key = dbm_nextkey(db))
That
is, establish positioning to the beginning by use of the dbm_firstkey()
function, then loop doing dbm_nextkey() function calls until a NULL dptr is
returned in datum.The returned dptr is valid only until the next dbm_ operation by this thread.
Special behavior for z/OS® UNIX Services: In a multithreaded environment, the dbm_nextkey() function returns a pointer to data that is thread-specific. In addition, each thread maintains its own positioning information for dbm_nextkey() operations. However, other threads making modifications to the database, for example using dbm_store() or dbm_delete() can cause unpredictable results for threads executing dbm_nextkey(), including keys retrieved multiple times or not at all. The application must reset positioning to the beginning using dbm_firstkey() if another thread has done a modification to the database.
Returned value
If successful, dbm_nextkey() returns the datum containing a pointer to the key dptr, and the key length dsize.
If unsuccessful, dbm_nextkey() returns a NULL pointer in dptr and returns the error value in errno. Also, the database error indicator may be set.
Related information
- ndbm.h
- dbm_clearerr() — Clear database error indicator
- dbm_close() — Close a database
- dbm_delete() — Delete database record
- dbm_error() — Check database error indicator
- dbm_fetch() — Get database content
- dbm_firstkey() — Get first key in database
- dbm_open() — Open a database
- dbm_store() — Store database record