June 2001
Intermediate to advanced
688 pages
19h 18m
English
Berkeley DB offers programmatic support for displaying error return values. The db_strerror interface returns a pointer to the error message corresponding to any Berkeley DB error return. This is similar to the ANSI C strerror interface, but it can handle both system error returns and Berkeley DB-specific return values.
For example:
int ret;
if ((ret = dbenv→set_cachesize(dbenv, 0, 32 * 1024)) != 0) {
fprintf(stderr, "set_cachesize failed: %s\n", db_strerror(ret));
return (1);
} There are also two additional error functions: DBENV→err and DBENV→errx. These functions work like the ANSI C printf interface, taking a printf-style format string and argument list, and writing a message constructed from the format string and arguments. ...