1<!--$Id: env_set_errcall.so,v 10.39 2006/05/17 20:47:46 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DbEnv::set_errcall</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DbEnv::set_errcall</b>
14</td>
15<td align=right>
16<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a>
17<a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db_cxx.h&gt;
23<p>
24void DbEnv::set_errcall(void (*db_errcall_fcn)
25    (const Dbenv *dbenv, const char *errpfx, const char *msg));
26</pre></b>
27<hr size=1 noshade>
28<b>Description: DbEnv::set_errcall</b>
29When an error occurs in the Berkeley DB library, an exception is thrown or an
30error return value is returned by the interface.  In some cases,
31however, the <b>errno</b> value may be insufficient to completely
32describe the cause of the error, especially during initial application
33debugging.
34<p>The DbEnv::set_errcall and <a href="/api_cxx/db_set_errcall.html">Db::set_errcall</a> methods are used to
35enhance the mechanism for reporting error messages to the application.
36In some cases, when an error occurs, Berkeley DB will call
37<b>db_errcall_fcn</b> with additional error information.  It is up to
38the <b>db_errcall_fcn</b> function to display the error message in an
39appropriate manner.</p>
40<p>Setting <b>db_errcall_fcn</b> to NULL unconfigures the callback interface.</p>
41<p>Alternatively, you can use the <a href="/api_cxx/env_set_error_stream.html">DbEnv::set_error_stream</a> and
42<a href="/api_cxx/db_set_error_stream.html">Db::set_error_stream</a> methods to display the additional information via
43an output stream, or the <a href="/api_cxx/db_set_errfile.html">Db::set_errfile</a> or
44<a href="/api_cxx/env_set_errfile.html">DbEnv::set_errfile</a> methods to display the additional information via a C
45library FILE *.  You should not mix these approaches.</p>
46<p>This error-logging enhancement does not slow performance or significantly
47increase application size, and may be run during normal operation as well
48as during application debugging.</p>
49<p>The DbEnv::set_errcall method configures operations performed using the specified
50<a href="/api_cxx/env_class.html">DbEnv</a> handle, not all operations performed on the underlying
51database environment.</p>
52<p>The DbEnv::set_errcall method may be called at any time during the life of the
53application.</p>
54<b>Parameters</b> <br>
55 <b>db_errcall_fcn</b><ul compact><li>The <b>db_errcall_fcn</b> parameter is the application-specified error
56reporting function.  The function takes three parameters:
57<br>
58<b><b>dbenv</b></b><ul compact><li>The <b>dbenv</b> parameter is the enclosing database environment.</ul>
59<b><b>errpfx</b></b><ul compact><li>The <b>errpfx</b> parameter is the prefix string (as previously set by
60<a href="/api_cxx/db_set_errpfx.html">Db::set_errpfx</a> or <a href="/api_cxx/env_set_errpfx.html">DbEnv::set_errpfx</a>).</ul>
61<b><b>msg</b></b><ul compact><li>The <b>msg</b> parameter is the error message string.</ul>
62<br>
63<p>Berkeley DB is not re-entrant.  Callback functions should not attempt to make
64library calls (for example, to release locks or close open handles).
65Re-entering Berkeley DB is not guaranteed to work correctly, and the results
66are undefined.</p></ul>
67<br>
68<hr size=1 noshade>
69<br><b>Class</b>
70<a href="/api_cxx/env_class.html">DbEnv</a>
71<br><b>See Also</b>
72<a href="/api_cxx/env_list.html">Database Environments and Related Methods</a>
73</tt>
74<table width="100%"><tr><td><br></td><td align=right>
75<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a><a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a>
76</td></tr></table>
77<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
78</body>
79</html>
80