Debian Codegraph @

docs/api_reference/C/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>DB_ENV-&gt;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 DB_ENV Handle" />
11 <link rel="prev" href="envevent_notify.html" title="DB_ENV-&gt;set_event_notify()" />
12 <link rel="next" href="envset_errfile.html" title="DB_ENV-&gt;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">DB_ENV-&gt;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 DB_ENV 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>DB_ENV-&gt;set_errcall()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 void
44 DB_ENV-&gt;set_errcall(DB_ENV *dbenv, void (*db_errcall_fcn)
45 (const DB_ENV *dbenv, const char *errpfx, const char *msg)); </pre>
46 <p>
47 When an error occurs in the Berkeley DB library,
48 <span>
49 a Berkeley DB error
50 </span>
51
52 or an error return value is returned by the interface. In some cases,
53 however, the <span class="bold"><strong>errno</strong></span> value may be
54 insufficient to completely describe the cause of the error, especially
55 during initial application debugging.
56 </p>
57 <p>
58 The <code class="methodname">DB_ENV-&gt;set_errcall()</code> and
59 <a class="xref" href="envset_errcall.html" title="DB_ENV-&gt;set_errcall()">DB_ENV-&gt;set_errcall()</a> methods
60 are used to enhance the mechanism for reporting error messages to the
61 application. In some cases, when an error occurs, Berkeley DB will
62 call <span class="bold"><strong>db_errcall_fcn</strong></span> with additional
63 error information. It is up to the <span class="bold"><strong>db_errcall_fcn</strong></span> function to display the error
64 message in an appropriate manner.
65 </p>
66 <p>
67 Setting <span class="bold"><strong>db_errcall_fcn</strong></span> to NULL
68 unconfigures the callback interface.
69 </p>
70 <p>
71 Alternatively, you can use the
72
73
74 <a class="xref" href="dbset_errfile.html" title="DB-&gt;set_errfile()">DB-&gt;set_errfile()</a> or
75 <a class="xref" href="envset_errfile.html" title="DB_ENV-&gt;set_errfile()">DB-&gt;set_errfile()</a>
76 methods to display the additional information via a C library <code class="literal">FILE *</code>.
77
78 </p>
79 <p>
80 This error-logging enhancement does not slow performance or
81 significantly increase application size, and may be run during normal
82 operation as well as during application debugging.
83 </p>
84 <p>
85 The <code class="methodname">DB_ENV-&gt;set_errcall()</code> method configures operations performed
86 using the specified <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a> handle, not all
87 operations performed on the underlying database environment.
88 </p>
89 <p>
90 The <code class="methodname">DB_ENV-&gt;set_errcall()</code> method may be called at any time during the
91 life of the application.
92 </p>
93 <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
94 <h3 class="title">Note</h3>
95 <p>
96 Berkeley DB is not re-entrant. Callback functions should not attempt to make library
97 calls (for example, to release locks or close open handles). Re-entering Berkeley DB is
98 not guaranteed to work correctly, and the results are undefined.
99 </p>
100 </div>
101 <div class="sect2" lang="en" xml:lang="en">
102 <div class="titlepage">
103 <div>
104 <div>
105 <h3 class="title"><a id="idp51940928"></a>Parameters</h3>
106 </div>
107 </div>
108 </div>
109 <div class="sect3" lang="en" xml:lang="en">
110 <div class="titlepage">
111 <div>
112 <div>
113 <h4 class="title"><a id="idp51941840"></a>db_errcall_fcn</h4>
114 </div>
115 </div>
116 </div>
117 <p>
118 The <span class="bold"><strong>db_errcall_fcn</strong></span> parameter is the
119 application-specified error reporting function. The function takes
120 three parameters:
121 </p>
122 <div class="itemizedlist">
123 <ul type="disc">
124 <li>
125 <p>
126 <code class="literal">dbenv</code>
127 </p>
128 <p>
129 The <span class="bold"><strong>dbenv</strong></span> parameter is the enclosing
130 database environment.
131 </p>
132 </li>
133 <li>
134 <p>
135 <code class="literal">errpfx</code>
136 </p>
137 <p>
138 The <span class="bold"><strong>errpfx</strong></span> parameter is the prefix
139 string (as previously set by
140 <a class="xref" href="dbset_errpfx.html" title="DB-&gt;set_errpfx()">DB-&gt;set_errpfx()</a> or
141 <a class="xref" href="envset_errpfx.html" title="DB_ENV-&gt;set_errpfx()">DB_ENV-&gt;set_errpfx()</a>).
142 </p>
143 </li>
144 <li>
145 <p>
146 <code class="literal">msg</code>
147 </p>
148 <p>
149 The <span class="bold"><strong>msg</strong></span> parameter is the error
150 message string.
151 </p>
152 </li>
153 </ul>
154 </div>
155 </div>
156 </div>
157 <div class="sect2" lang="en" xml:lang="en">
158 <div class="titlepage">
159 <div>
160 <div>
161 <h3 class="title"><a id="idp51912376"></a>Class</h3>
162 </div>
163 </div>
164 </div>
165 <p>
166 <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a>
167 </p>
168 </div>
169 <div class="sect2" lang="en" xml:lang="en">
170 <div class="titlepage">
171 <div>
172 <div>
173 <h3 class="title"><a id="idp51907688"></a>See Also</h3>
174 </div>
175 </div>
176 </div>
177 <p>
178 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a>
179 </p>
180 </div>
181 </div>
182 <div class="navfooter">
183 <hr />
184 <table width="100%" summary="Navigation footer">
185 <tr>
186 <td width="40%" align="left"><a accesskey="p" href="envevent_notify.html">Prev</a> </td>
187 <td width="20%" align="center">
188 <a accesskey="u" href="env.html">Up</a>
189 </td>
190 <td width="40%" align="right"> <a accesskey="n" href="envset_errfile.html">Next</a></td>
191 </tr>
192 <tr>
193 <td width="40%" align="left" valign="top">DB_ENV-&gt;set_event_notify() </td>
194 <td width="20%" align="center">
195 <a accesskey="h" href="index.html">Home</a>
196 </td>
197 <td width="40%" align="right" valign="top"> DB_ENV-&gt;set_errfile()</td>
198 </tr>
199 </table>
200 </div>
201 </body>
202 </html>