<!--$Id: db_set_paniccall.so,v 10.14 2002/08/18 21:15:57 bostic Exp $--> <!--$Id: env_set_paniccall.so,v 10.36 2003/11/08 19:17:32 bostic Exp $--> <!--Copyright 1997-2003 by Sleepycat Software, Inc.--> <!--All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB: Db::set_paniccall</title> <meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> <meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> </head> <body bgcolor=white> <a name="2"><!--meow--></a> <table width="100%"><tr valign=top> <td> <h3>Db::set_paniccall</h3> </td> <td align=right> <a href="../../db42-devel-4.2.52/api_cxx/api_index.html"><img src="../../db42-4.2.52/images/api.gif" alt="API"></a> <a href="../../db42-devel-4.2.52/ref/toc.html"><img src="../../db42-4.2.52/images/ref.gif" alt="Ref"></a> </td></tr></table> <hr size=1 noshade> <tt> <h3><pre> #include <db_cxx.h> <p> int Db::set_paniccall(void (*db_panic_fcn)(DbEnv *dbenv, int errval)); </pre></h3> <hr size=1 noshade> <h3>Description: Db::set_paniccall</h3> <p>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 <a href="../../db42-devel-4.2.52/ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> or throw a <a href="../../db42-devel-4.2.52/api_cxx/runrec_class.html">DbRunRecoveryException</a>, 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 <a href="../../db42-devel-4.2.52/ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> is about to be returned or <a href="../../db42-devel-4.2.52/api_cxx/runrec_class.html">DbRunRecoveryException</a> is about to be thrown from a Berkeley DB method.</p> <p>For <a href="../../db42-devel-4.2.52/api_cxx/db_class.html">Db</a> handles opened inside of Berkeley DB environments, calling the Db::set_paniccall method affects the entire environment and is equivalent to calling the <a href="../../db42-devel-4.2.52/api_cxx/env_set_paniccall.html">DbEnv::set_paniccall</a> method.</p> <p>The Db::set_paniccall method may be called at any time during the life of the application.</p> <p>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. </p> <h3>Parameters</h3> <p><dl compact> <p><dt><b>db_panic_fcn</b><dd> The <b>db_panic_fcn</b> parameter is the application-specified function called in the case of a database environment panic. The function takes two arguments: <p><dl compact> <p><dt><b>dbenv</b><dd>The <b>dbenv</b> parameter is the enclosing database environment handle. <p><dt><b>errval</b><dd>The <b>errval</b> parameter is the error value that would have been returned to the caller if <a href="../../db42-devel-4.2.52/ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> were not going to be returned instead. </dl> </dl> <hr size=1 noshade> <h3>Class</h3> <a href="../../db42-devel-4.2.52/api_cxx/db_class.html">Db</a> <h3>See Also</h3> <a href="../../db42-devel-4.2.52/api_cxx/db_list.html">Databases and Related Methods</a> </tt> <table width="100%"><tr><td><br></td><td align=right> <a href="../../db42-devel-4.2.52/api_cxx/api_index.html"><img src="../../db42-4.2.52/images/api.gif" alt="API"></a><a href="../../db42-devel-4.2.52/ref/toc.html"><img src="../../db42-4.2.52/images/ref.gif" alt="Ref"></a> </td></tr></table> <p><font size=1><a href="../../db42-devel-4.2.52/sleepycat/legal.html">Copyright (c) 1996-2003</a> <a href="http://www.sleepycat.com">Sleepycat Software, Inc.</a> - All rights reserved.</font> </body> </html>