DB->err

APIRef

#include <db.h>

void DB->err(DB *db, int error, const char *fmt, ...);

void DB->errx(DB *db, const char *fmt, ...);

Description

The DB_ENV->err, DB_ENV->errx, DB->err and DB->errx functions provide error-messaging functionality for applications written using the Berkeley DB library.

The DB_ENV->err function constructs an error message consisting of the following elements:

An optional prefix string
If no error callback function has been set using the DB_ENV->set_errcall function, any prefix string specified using the DB_ENV->set_errpfx function, followed by two separating characters: a colon and a <space> character.

An optional printf-style message
The supplied message fmt, if non-NULL, in which the ANSI C X3.159-1989 (ANSI C) printf function specifies how subsequent arguments are converted for output.

A separator
Two separating characters: a colon and a <space> character.

A standard error string
The standard system or Berkeley DB library error string associated with the error value, as returned by the db_strerror function.

This constructed error message is then handled as follows:

If an error callback function has been set (see DB->set_errcall and DB_ENV->set_errcall), that function is called with two arguments: any prefix string specified (see DB->set_errpfx and DB_ENV->set_errpfx) and the error message.

If a C library FILE * has been set (see DB->set_errfile and DB_ENV->set_errfile), the error message is written to that output stream.

If none of these output options has been configured, the error message is written to stderr, the standard error output stream.

The DB_ENV->errx and DB->errx functions perform identically to the DB_ENV->err and DB->err functions, except that they do not append the final separator characters and standard error string to the error message.

See Also

db_create, DB->associate, DB->close, DB->cursor, DB->del, DB->err, DB->errx DB->fd, DB->get, DB->pget, DB->get_byteswapped, DB->get_type, DB->join, DB->key_range, DB->open, DB->put, DB->remove, DB->rename, DB->set_alloc, DB->set_append_recno, DB->set_bt_compare, DB->set_bt_minkey, DB->set_bt_prefix, DB->set_cachesize, DB->set_dup_compare, DB->set_errcall, DB->set_errfile, DB->set_errpfx, DB->set_feedback, DB->set_flags, DB->set_h_ffactor, DB->set_h_hash, DB->set_h_nelem, DB->set_lorder, DB->set_pagesize, DB->set_paniccall, DB->set_q_extentsize, DB->set_re_delim, DB->set_re_len, DB->set_re_pad, DB->set_re_source, DB->stat, DB->sync, DB->truncate, DB->upgrade, and DB->verify.

APIRef

Copyright Sleepycat Software