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