DB_ENV->err

APIRef

#include <db.h>

void DB_ENV->err(DB_ENV *dbenv, int error, const char *fmt, ...);

void DB_ENV->errx(DB_ENV *dbenv, 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_env_create, DB_ENV->close, DB_ENV->err, DB_ENV->errx DB_ENV->open, DB_ENV->remove, DB_ENV->set_alloc, DB_ENV->set_cachesize, DB_ENV->set_data_dir, DB_ENV->set_errcall, DB_ENV->set_errfile, DB_ENV->set_errpfx, DB_ENV->set_feedback, DB_ENV->set_flags, DB_ENV->set_paniccall, DB_ENV->set_recovery_init, DB_ENV->set_rpc_server, DB_ENV->set_shm_key, DB_ENV->set_tas_spins, DB_ENV->set_tmp_dir, DB_ENV->set_timeout, DB_ENV->set_verbose, db_strerror and db_version.

APIRef

Copyright Sleepycat Software