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