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