env_set_paniccall.html   [plain text]


<!--$Id: env_set_paniccall.html,v 1.2 2004/03/30 01:21:42 jtownsen Exp $-->
<!--Copyright 1997-2003 by Sleepycat Software, Inc.-->
<!--All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DB_ENV-&gt;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_ENV-&gt;set_paniccall</h3>
</td>
<td align=right>
<a href="../api_c/api_index.html"><img src="../images/api.gif" alt="API"></a>
<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<hr size=1 noshade>
<tt>
<h3><pre>
#include &lt;db.h&gt;
<p>
int
DB_ENV-&gt;set_paniccall(DB_ENV *dbenv,
    void (*db_panic_fcn)(DB_ENV *dbenv, int errval));
</pre></h3>
<hr size=1 noshade>
<h3>Description: DB_ENV-&gt;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
return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>.
It is often easier to simply exit the application when such errors occur
rather than gracefully return up the stack.  The DB_ENV-&gt;set_paniccall method
specifies a function to be called when
<a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> is about to be returned
from a Berkeley DB method.</p>
<p>The DB_ENV-&gt;set_paniccall method may be called at any time during the life of the
application.</p>
<p>The DB_ENV-&gt;set_paniccall method
returns a non-zero error value on failure
and 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="../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="../api_c/env_class.html">DB_ENV</a>
<h3>See Also</h3>
<a href="../api_c/env_list.html">Database Environments and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../api_c/api_index.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1><a href="../sleepycat/legal.html">Copyright (c) 1996-2003</a> <a href="http://www.sleepycat.com">Sleepycat Software, Inc.</a> - All rights reserved.</font>
</body>
</html>