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