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