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_c/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 <db.h> 24<p> 25void 26DB->set_errcall(DB *, void (*db_errcall_fcn) 27 (const DB_ENV *dbenv, const char *errpfx, const char *msg)); 28</pre></b> 29<hr size=1 noshade> 30<b>Description: DB->set_errcall</b> 31<p>When an error occurs in the Berkeley DB library, a Berkeley DB error or an error 32return value is returned by the interface. In some cases, however, 33the <b>errno</b> value may be insufficient to completely describe 34the cause of the error, especially during initial application debugging.</p> 35<p>The <a href="../api_c/env_set_errcall.html">DB_ENV->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_c/db_set_errfile.html">DB->set_errfile</a> or 43<a href="../api_c/env_set_errfile.html">DB_ENV->set_errfile</a> methods to display the additional information via 44a C library FILE *.</p> 45<p>This error-logging enhancement does not slow performance or significantly 46increase application size, and may be run during normal operation as well 47as during application debugging.</p> 48<p>For <a href="../api_c/db_class.html">DB</a> handles opened inside of Berkeley DB environments, calling the 49DB->set_errcall method affects the entire environment and is equivalent to calling 50the <a href="../api_c/env_set_errcall.html">DB_ENV->set_errcall</a> method.</p> 51<p>The DB->set_errcall method configures operations performed using the specified 52<a href="../api_c/db_class.html">DB</a> handle, not all operations performed on the underlying 53database.</p> 54<p>The DB->set_errcall method may be called at any time during the life of the 55application.</p> 56<b>Parameters</b> <br> 57 <b>db_errcall_fcn</b><ul compact><li>The <b>db_errcall_fcn</b> parameter is the application-specified error 58reporting function. The function takes three parameters: 59<br> 60<b><b>dbenv</b></b><ul compact><li>The <b>dbenv</b> parameter is the enclosing database environment.</ul> 61<b><b>errpfx</b></b><ul compact><li>The <b>errpfx</b> parameter is the prefix string (as previously set by 62<a href="../api_c/db_set_errpfx.html">DB->set_errpfx</a> or <a href="../api_c/env_set_errpfx.html">DB_ENV->set_errpfx</a>).</ul> 63<b><b>msg</b></b><ul compact><li>The <b>msg</b> parameter is the error message string.</ul> 64<br> 65<p>Berkeley DB is not re-entrant. Callback functions should not attempt to make 66library calls (for example, to release locks or close open handles). 67Re-entering Berkeley DB is not guaranteed to work correctly, and the results 68are undefined.</p></ul> 69<br> 70<hr size=1 noshade> 71<br><b>Class</b> 72<a href="../api_c/db_class.html">DB</a> 73<br><b>See Also</b> 74<a href="../api_c/db_list.html">Databases and Related Methods</a> 75</tt> 76<table width="100%"><tr><td><br></td><td align=right> 77<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a> 78</td></tr></table> 79<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 80</body> 81</html> 82