Debian Codegraph @

docs/api_reference/CXX/envset_errcall.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <title>DbEnv::set_errcall()</title>
7 <link rel="stylesheet" href="apiReference.css" type="text/css" />
8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9 <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" />
10 <link rel="up" href="env.html" title="Chapter 5.  The DbEnv Handle" />
11 <link rel="prev" href="envevent_notify.html" title="DbEnv::set_event_notify()" />
12 <link rel="next" href="envset_errfile.html" title="DbEnv::set_errfile()" />
13 </head>
14 <body>
15 <div xmlns="" class="navheader">
16 <div class="libver">
17 <p>Library Version 11.2.5.3</p>
18 </div>
19 <table width="100%" summary="Navigation header">
20 <tr>
21 <th colspan="3" align="center">DbEnv::set_errcall()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="envevent_notify.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 5. 
26 The DbEnv Handle
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="envset_errfile.html">Next</a></td>
29 </tr>
30 </table>
31 <hr />
32 </div>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
35 <div>
36 <div>
37 <h2 class="title" style="clear: both"><a id="envset_errcall"></a>DbEnv::set_errcall()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db_cxx.h&gt;
42
43 void DbEnv::set_errcall(void (*db_errcall_fcn)
44 (const Dbenv *dbenv, const char *errpfx, const char *msg));</pre>
45 <p>
46 When an error occurs in the Berkeley DB library,
47
48 <span>
49 an exception is thrown
50 </span>
51 or an error return value is returned by the interface. In some cases,
52 however, the <span class="bold"><strong>errno</strong></span> value may be
53 insufficient to completely describe the cause of the error, especially
54 during initial application debugging.
55 </p>
56 <p>
57 The <code class="methodname">DbEnv::set_errcall()</code> and
58 <a class="xref" href="envset_errcall.html" title="DbEnv::set_errcall()">DbEnv::set_errcall()</a> methods
59 are used to enhance the mechanism for reporting error messages to the
60 application. In some cases, when an error occurs, Berkeley DB will
61 call <span class="bold"><strong>db_errcall_fcn</strong></span> with additional
62 error information. It is up to the <span class="bold"><strong>db_errcall_fcn</strong></span> function to display the error
63 message in an appropriate manner.
64 </p>
65 <p>
66 Setting <span class="bold"><strong>db_errcall_fcn</strong></span> to NULL
67 unconfigures the callback interface.
68 </p>
69 <p>
70 Alternatively, you can use the
71 <span>
72 <a class="xref" href="envset_error_stream.html" title="DbEnv::set_error_stream()">DbEnv::set_error_stream()</a>
73 and
74 <a class="xref" href="dbset_error_stream.html" title="Db::set_error_stream()">Db::set_error_stream()</a>
75 methods to display the additional information via an output stream, or the
76 </span>
77
78 <a class="xref" href="dbset_errfile.html" title="Db::set_errfile()">Db::set_errfile()</a> or
79 <a class="xref" href="envset_errfile.html" title="DbEnv::set_errfile()">Db::set_errfile()</a>
80 methods to display the additional information via a C library <code class="literal">FILE *</code>.
81 <span>You should not mix these approaches.</span>
82 </p>
83 <p>
84 This error-logging enhancement does not slow performance or
85 significantly increase application size, and may be run during normal
86 operation as well as during application debugging.
87 </p>
88 <p>
89 The <code class="methodname">DbEnv::set_errcall()</code> method configures operations performed
90 using the specified <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a> handle, not all
91 operations performed on the underlying database environment.
92 </p>
93 <p>
94 The <code class="methodname">DbEnv::set_errcall()</code> method may be called at any time during the
95 life of the application.
96 </p>
97 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
98 <h3 class="title">Note</h3>
99 <p>
100 Berkeley DB is not re-entrant. Callback functions should not attempt to make library
101 calls (for example, to release locks or close open handles). Re-entering Berkeley DB is
102 not guaranteed to work correctly, and the results are undefined.
103 </p>
104 </div>
105 <div class="sect2" lang="en" xml:lang="en">
106 <div class="titlepage">
107 <div>
108 <div>
109 <h3 class="title"><a id="idp7264552"></a>Parameters</h3>
110 </div>
111 </div>
112 </div>
113 <div class="sect3" lang="en" xml:lang="en">
114 <div class="titlepage">
115 <div>
116 <div>
117 <h4 class="title"><a id="idp7246152"></a>db_errcall_fcn</h4>
118 </div>
119 </div>
120 </div>
121 <p>
122 The <span class="bold"><strong>db_errcall_fcn</strong></span> parameter is the
123 application-specified error reporting function. The function takes
124 three parameters:
125 </p>
126 <div class="itemizedlist">
127 <ul type="disc">
128 <li>
129 <p>
130 <code class="literal">dbenv</code>
131 </p>
132 <p>
133 The <span class="bold"><strong>dbenv</strong></span> parameter is the enclosing
134 database environment.
135 </p>
136 </li>
137 <li>
138 <p>
139 <code class="literal">errpfx</code>
140 </p>
141 <p>
142 The <span class="bold"><strong>errpfx</strong></span> parameter is the prefix
143 string (as previously set by
144 <a class="xref" href="dbset_errpfx.html" title="Db::set_errpfx()">Db::set_errpfx()</a> or
145 <a class="xref" href="envset_errpfx.html" title="DbEnv::set_errpfx()">DbEnv::set_errpfx()</a>).
146 </p>
147 </li>
148 <li>
149 <p>
150 <code class="literal">msg</code>
151 </p>
152 <p>
153 The <span class="bold"><strong>msg</strong></span> parameter is the error
154 message string.
155 </p>
156 </li>
157 </ul>
158 </div>
159 </div>
160 </div>
161 <div class="sect2" lang="en" xml:lang="en">
162 <div class="titlepage">
163 <div>
164 <div>
165 <h3 class="title"><a id="idp7329904"></a>Class</h3>
166 </div>
167 </div>
168 </div>
169 <p>
170 <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>
171 </p>
172 </div>
173 <div class="sect2" lang="en" xml:lang="en">
174 <div class="titlepage">
175 <div>
176 <div>
177 <h3 class="title"><a id="idp7253288"></a>See Also</h3>
178 </div>
179 </div>
180 </div>
181 <p>
182 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a>
183 </p>
184 </div>
185 </div>
186 <div class="navfooter">
187 <hr />
188 <table width="100%" summary="Navigation footer">
189 <tr>
190 <td width="40%" align="left"><a accesskey="p" href="envevent_notify.html">Prev</a> </td>
191 <td width="20%" align="center">
192 <a accesskey="u" href="env.html">Up</a>
193 </td>
194 <td width="40%" align="right"> <a accesskey="n" href="envset_errfile.html">Next</a></td>
195 </tr>
196 <tr>
197 <td width="40%" align="left" valign="top">DbEnv::set_event_notify() </td>
198 <td width="20%" align="center">
199 <a accesskey="h" href="index.html">Home</a>
200 </td>
201 <td width="40%" align="right" valign="top"> DbEnv::set_errfile()</td>
202 </tr>
203 </table>
204 </div>
205 </body>
206 </html>