1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
<!--$Id: except_class.so,v 10.38 2004/09/28 15:04:19 bostic Exp $-->
<!--Copyright 1997-2004 by Sleepycat Software, Inc.-->
<!--All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DbException</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<table width="100%"><tr valign=top>
<td>
<h3>DbException</h3>
</td>
<td align=right>
<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a>
<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
</tr></table>
<hr size=1 noshade>
<tt>
<h3><pre>
#include <db_cxx.h>
<p>
class DbException {
public:
int get_errno() const;
virtual const char *what() const;
DbEnv *get_env() const;
};
</pre></h3>
<hr size=1 noshade>
<h3>Description: DbException</h3>
<p>This information describes the DbException class and how it is
used by the various Berkeley DB classes.</p>
<p>Most methods in the Berkeley DB classes return an int, but also throw an
exception. This allows for two different error behaviors. By default,
the Berkeley DB C++ API is configured to throw an exception whenever a serious
error occurs. This generally allows for cleaner logic for transaction
processing because a try block can surround a single transaction.
Alternatively, Berkeley DB can be configured to not throw exceptions, and
instead have the individual function return an error code, by setting
the <a href="../api_cxx/env_class.html#DB_CXX_NO_EXCEPTIONS">DB_CXX_NO_EXCEPTIONS</a> for the <a href="../api_cxx/db_class.html">Db</a> and <a href="../api_cxx/env_class.html">DbEnv</a>
constructors.</p>
<p>A DbException object contains an informational string, an errno, and a
reference to the environment from which the exception was thrown. The
errno can be obtained by using DbException::get_errno, and can be
used, in standard cases, to determine the type of the exception. The
informational string can be obtained by using DbException::what. And,
the environment can be obtained using DbException::get_env.</p>
<p>We expect in the future that this class will inherit from the standard
class exception, but certain language implementation bugs currently
prevent this on some platforms.</p>
<p>Some methods may return non-zero values without issuing an exception.
This occurs in situations that are not normally considered an error, but
when some informational status is returned. For example,
<a href="../api_cxx/db_get.html">Db::get</a> returns <a href="../ref/program/errorret.html#DB_NOTFOUND">DB_NOTFOUND</a> when a requested key does
not appear in the database.</p>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1><a href="../sleepycat/legal.html">Copyright (c) 1996-2004</a> <a href="http://www.sleepycat.com">Sleepycat Software, Inc.</a> - All rights reserved.</font>
</body>
</html>
|