DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

Db::set_paniccall

API Ref

#include <db_cxx.h>

int Db::set_paniccall(void (*db_panic_fcn)(DbEnv *dbenv, int errval));


Description: Db::set_paniccall

Errors can occur in the Berkeley DB library where the only solution is to shut down the application and run recovery (for example, if Berkeley DB is unable to allocate heap memory). In such cases, the Berkeley DB methods will either return DB_RUNRECOVERY or throw a DbRunRecoveryException, depending on the API configuration. It is often easier to simply exit the application when such errors occur rather than gracefully return up the stack. The Db::set_paniccall method specifies a function to be called when DB_RUNRECOVERY is about to be returned or DbRunRecoveryException is about to be thrown from a Berkeley DB method.

For Db handles opened inside of Berkeley DB environments, calling the Db::set_paniccall method affects the entire environment and is equivalent to calling the DbEnv::set_paniccall method.

The Db::set_paniccall method may be called at any time during the life of the application.

The Db::set_paniccall method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

Parameters

db_panic_fcn
The db_panic_fcn parameter is the application-specified function called in the case of a database environment panic. The function takes two arguments:
dbenv
The dbenv parameter is the enclosing database environment handle.
errval
The errval parameter is the error value that would have been returned to the caller if DB_RUNRECOVERY were not going to be returned instead.

Class

Db

See Also

Databases and Related Methods

APIRef

Copyright (c) 1996-2005 Sleepycat Software, Inc. - All rights reserved.