Debian Codegraph @

docs/api_reference/CXX/dbexception.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>Chapter 6. The DbException Class</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="index.html" title="Berkeley DB C++ API Reference" />
11 <link rel="prev" href="envversion.html" title="DbEnv::version()" />
12 <link rel="next" href="dbdeadlock.html" title="DbDeadlockException" />
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">Chapter 6. The DbException Class</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="envversion.html">Prev</a> </td>
25 <th width="60%" align="center"> </th>
26 <td width="20%" align="right"> <a accesskey="n" href="dbdeadlock.html">Next</a></td>
27 </tr>
28 </table>
29 <hr />
30 </div>
31 <div class="chapter" lang="en" xml:lang="en">
32 <div class="titlepage">
33 <div>
34 <div>
35 <h2 class="title"><a id="dbexception"></a>Chapter 6. The DbException Class</h2>
36 </div>
37 </div>
38 </div>
39 <pre class="programlisting">#include &lt;db_cxx.h&gt;
40 class DbException {
41 public:
42 int get_errno() const;
43 virtual const char *what() const;
44 DbEnv *get_env() const;
45 }; </pre>
46 <p>
47 This information describes the <code class="classname">DbException</code> class and how
48 it is used by the various Berkeley DB classes.
49 </p>
50 <p>
51 Most methods in the Berkeley DB classes return an <code class="literal">int</code>, but also throw
52 an exception. This allows for two different error behaviors. By default, the Berkeley DB
53 C++ API is configured to throw an exception whenever a serious error occurs. This
54 generally allows for cleaner logic for transaction processing because a try block can
55 surround a single transaction. Alternatively, Berkeley DB can be configured to not throw
56 exceptions, and instead have the individual function return an error code, by setting
57 the <a class="link" href="envcreate.html#env_DB_CXX_NO_EXCEPTIONS">DB_CXX_NO_EXCEPTIONS</a>
58 for the <a class="xref" href="dbcreate.html" title="Db">Db</a> and
59 <a class="xref" href="envcreate.html" title="DbEnv">DbEnv</a> constructors.
60 </p>
61 <p>
62 A <code class="classname">DbException</code> object contains an informational string, an
63 <code class="literal">errno</code>, and a reference to the environment from which the exception
64 was thrown. The <code class="literal">errno</code> can be obtained by using the
65 <code class="methodname">DbException::get_errno()</code> method, and can be used, in standard
66 cases, to determine the type of the exception. The informational string can be obtained
67 by using the <code class="methodname">DbException::what()</code>. And, the environment can be
68 obtained using the <code class="methodname">DbException::get_env()</code> method.
69 </p>
70 <p>
71 Where available, this class inherits from the standard class exception.
72 </p>
73 <p>
74 Some methods may return non-zero values without issuing an exception. This occurs in
75 situations that are not normally considered an error, but when some informational status
76 is returned. For example, the <a class="xref" href="dbget.html" title="Db::get()">Db::get()</a> method returns
77 <a href="../../programmer_reference/program_errorret.html#program_errorret.DB_NOTFOUND" class="olink">DB_NOTFOUND</a>
78 when a requested key does not appear in the database.
79 </p>
80 <div class="sect1" lang="en" xml:lang="en">
81 <div class="titlepage">
82 <div>
83 <div>
84 <h2 class="title" style="clear: both"><a id="exceptionlist"></a>DB C++ Exceptions</h2>
85 </div>
86 </div>
87 </div>
88 <div class="navtable">
89 <table border="1" width="80%">
90 <thead>
91 <tr>
92 <th>DB C++ Exceptions</th>
93 <th>Description</th>
94 </tr>
95 </thead>
96 <tbody>
97 <tr>
98 <td>
99 <a class="xref" href="dbdeadlock.html" title="DbDeadlockException">DbDeadlockException</a>
100 </td>
101 <td>Exception class for deadlocks</td>
102 </tr>
103 <tr>
104 <td>
105 <a class="xref" href="dblocknotgranted.html" title="DbLockNotGrantedException">DbLockNotGrantedException</a>
106 </td>
107 <td>Exception class for lock request failures</td>
108 </tr>
109 <tr>
110 <td>
111 <a class="xref" href="dbmemory.html" title="DbMemoryException">DbMemoryException</a>
112 </td>
113 <td>Exception class for insufficient memory</td>
114 </tr>
115 <tr>
116 <td>
117 <a class="xref" href="dbrephandledead.html" title="DbRepHandleDeadException">DbRepHandleDeadException</a>
118 </td>
119 <td>Exception class for database and cursor handles that are invalidated in a replicated application. </td>
120 </tr>
121 <tr>
122 <td>
123 <a class="xref" href="dbrunrecovery.html" title="DbRunRecoveryException">DbRunRecoveryException</a>
124 </td>
125 <td>Exception class for failures requiring recovery</td>
126 </tr>
127 </tbody>
128 </table>
129 </div>
130 </div>
131 </div>
132 <div class="navfooter">
133 <hr />
134 <table width="100%" summary="Navigation footer">
135 <tr>
136 <td width="40%" align="left"><a accesskey="p" href="envversion.html">Prev</a> </td>
137 <td width="20%" align="center"> </td>
138 <td width="40%" align="right"> <a accesskey="n" href="dbdeadlock.html">Next</a></td>
139 </tr>
140 <tr>
141 <td width="40%" align="left" valign="top">DbEnv::version() </td>
142 <td width="20%" align="center">
143 <a accesskey="h" href="index.html">Home</a>
144 </td>
145 <td width="40%" align="right" valign="top"> DbDeadlockException</td>
146 </tr>
147 </table>
148 </div>
149 </body>
150 </html>