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::err()</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="db.html" title="Chapter��2.�� The Db Handle" /> 11 <link rel="prev" href="dbdel.html" title="Db::del()" /> 12 <link rel="next" href="dbexists.html" title="Db::exists()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Db::err()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="dbdel.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��2.�� 23 The Db Handle 24 </th> 25 <td width="20%" align="right">��<a accesskey="n" href="dbexists.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="dberr"></a>Db::err()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40Db::err(int error, const char *fmt, ...); 41 42Db::errx(const char *fmt, ...);</pre> 43 <p> 44 The <a class="xref" href="enverr.html" title="DbEnv::err()">DbEnv::err()</a>, 45 <code class="methodname">DbEnv::errx()</code>, <code class="methodname">Db::err()</code> and 46 <code class="methodname">Db::errx()</code> methods provide error-messaging functionality for 47 applications written using the Berkeley DB library. 48 </p> 49 <p> 50 The <code class="methodname">Db::err()</code> and <a class="xref" href="enverr.html" title="DbEnv::err()">DbEnv::err()</a> methods construct 51 an error message consisting of the following elements: 52 </p> 53 <div class="itemizedlist"> 54 <ul type="disc"> 55 <li> 56 <p> 57 <span class="bold"><strong>An optional prefix string</strong></span> 58 </p> 59 <p> 60 If no error callback function has been set using the 61 <a class="xref" href="envset_errcall.html" title="DbEnv::set_errcall()">DbEnv::set_errcall()</a> 62 method, any prefix string specified using the 63 <a class="xref" href="envset_errpfx.html" title="DbEnv::set_errpfx()">DbEnv::set_errpfx()</a> 64 method, followed by two separating characters: a colon and a 65 <space> character. 66 </p> 67 </li> 68 <li> 69 <p> 70 <span class="bold"><strong>An optional printf-style message</strong></span> 71 </p> 72 <p> 73 The supplied message <span class="bold"><strong>fmt</strong></span>, if 74 non-NULL, in which the ANSI C X3.159-1989 (ANSI C) printf function 75 specifies how subsequent parameters are converted for output. 76 </p> 77 </li> 78 <li> 79 <p> 80 <span class="bold"><strong>A separator</strong></span> 81 </p> 82 <p> 83 Two separating characters: a colon and a <space> character. 84 </p> 85 </li> 86 <li> 87 <p> 88 <span class="bold"><strong>A standard error string</strong></span> 89 </p> 90 <p> 91 The standard system or Berkeley DB library error string associated 92 with the <span class="bold"><strong>error</strong></span> value, as returned by 93 the <a class="xref" href="envstrerror.html" title="DbEnv::strerror()">DbEnv::strerror()</a> 94 method. 95 </p> 96 </li> 97 </ul> 98 </div> 99 <p> 100 The <code class="methodname">Db::errx()</code> and <code class="methodname">DbEnv::errx()</code> methods 101 are the same as the <code class="methodname">Db::err()</code> and 102 <a class="xref" href="enverr.html" title="DbEnv::err()">DbEnv::err()</a> methods, except they do not append 103 the final separator characters and standard error string to the error message. 104 </p> 105 <p> 106 This constructed error message is then handled as follows: 107 </p> 108 <div class="itemizedlist"> 109 <ul type="disc"> 110 <li> 111 <p> 112 If an error callback function has been set (see 113 <a class="xref" href="dbset_errcall.html" title="Db::set_errcall()">Db::set_errcall()</a> and 114 <a class="xref" href="envset_errcall.html" title="DbEnv::set_errcall()">DbEnv::set_errcall()</a>), 115 that function is called with two parameters: any prefix string 116 specified (see <a class="xref" href="dbset_errpfx.html" title="Db::set_errpfx()">Db::set_errpfx()</a> 117 and <a class="xref" href="envset_errpfx.html" title="DbEnv::set_errpfx()">DbEnv::set_errpfx()</a>) and 118 the error message. 119 </p> 120 </li> 121 <li> 122 <p> 123 If a C library FILE * has been set (see 124 <a class="xref" href="dbset_errfile.html" title="Db::set_errfile()">Db::set_errfile()</a> and 125 <a class="xref" href="envset_errfile.html" title="DbEnv::set_errfile()">DbEnv::set_errfile()</a>), 126 the error message is written to that output stream. 127 </p> 128 </li> 129 <li> 130 <p> 131 If a C++ ostream has been set (see 132 <a class="xref" href="envset_error_stream.html" title="DbEnv::set_error_stream()">DbEnv::set_error_stream()</a> 133 and 134 <a class="xref" href="dbset_error_stream.html" title="Db::set_error_stream()">Db::set_error_stream()</a>), 135 the error message is written to that stream. 136 </p> 137 </li> 138 <li> 139 <p> 140 If none of these output options have been configured, the error message 141 is written to stderr, the standard error output stream. 142 </p> 143 </li> 144 </ul> 145 </div> 146 <div class="sect2" lang="en" xml:lang="en"> 147 <div class="titlepage"> 148 <div> 149 <div> 150 <h3 class="title"><a id="id1633675"></a>Parameters</h3> 151 </div> 152 </div> 153 </div> 154 <div class="sect3" lang="en" xml:lang="en"> 155 <div class="titlepage"> 156 <div> 157 <div> 158 <h4 class="title"><a id="id1633921"></a>error</h4> 159 </div> 160 </div> 161 </div> 162 <p> 163 The <span class="bold"><strong>error</strong></span> parameter is the error 164 value for which the <a class="xref" href="enverr.html" title="DbEnv::err()">DbEnv::err()</a> 165 and <code class="methodname">Db::err()</code> methods will display an explanatory string. 166 </p> 167 </div> 168 <div class="sect3" lang="en" xml:lang="en"> 169 <div class="titlepage"> 170 <div> 171 <div> 172 <h4 class="title"><a id="id1633841"></a>fmt</h4> 173 </div> 174 </div> 175 </div> 176 <p> 177 The <span class="bold"><strong>fmt</strong></span> parameter is an optional 178 printf-style message to display. 179 </p> 180 </div> 181 </div> 182 <div class="sect2" lang="en" xml:lang="en"> 183 <div class="titlepage"> 184 <div> 185 <div> 186 <h3 class="title"><a id="id1633626"></a>Class</h3> 187 </div> 188 </div> 189 </div> 190 <p> 191 <a class="link" href="db.html" title="Chapter��2.�� The Db Handle">Db</a> 192 </p> 193 </div> 194 <div class="sect2" lang="en" xml:lang="en"> 195 <div class="titlepage"> 196 <div> 197 <div> 198 <h3 class="title"><a id="id1633835"></a>See Also</h3> 199 </div> 200 </div> 201 </div> 202 <p> 203 <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a> 204 </p> 205 </div> 206 </div> 207 <div class="navfooter"> 208 <hr /> 209 <table width="100%" summary="Navigation footer"> 210 <tr> 211 <td width="40%" align="left"><a accesskey="p" href="dbdel.html">Prev</a>��</td> 212 <td width="20%" align="center"> 213 <a accesskey="u" href="db.html">Up</a> 214 </td> 215 <td width="40%" align="right">��<a accesskey="n" href="dbexists.html">Next</a></td> 216 </tr> 217 <tr> 218 <td width="40%" align="left" valign="top">Db::del()��</td> 219 <td width="20%" align="center"> 220 <a accesskey="h" href="index.html">Home</a> 221 </td> 222 <td width="40%" align="right" valign="top">��Db::exists()</td> 223 </tr> 224 </table> 225 </div> 226 </body> 227</html> 228