~ubuntu-branches/ubuntu/edgy/rpm/edgy

« back to all changes in this revision

Viewing changes to db/docs/ref/simple_tut/errors.html

  • Committer: Bazaar Package Importer
  • Author(s): Joey Hess
  • Date: 2002-01-22 20:56:57 UTC
  • Revision ID: james.westby@ubuntu.com-20020122205657-l74j50mr9z8ofcl5
Tags: upstream-4.0.3
ImportĀ upstreamĀ versionĀ 4.0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!--$Id: errors.so,v 10.20 2001/03/01 15:58:13 bostic Exp $-->
 
2
<!--Copyright 1997-2001 by Sleepycat Software, Inc.-->
 
3
<!--All rights reserved.-->
 
4
<html>
 
5
<head>
 
6
<title>Berkeley DB Reference Guide: Error returns</title>
 
7
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
 
8
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
 
9
</head>
 
10
<body bgcolor=white>
 
11
<table width="100%"><tr valign=top>
 
12
<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Simple Tutorial</dl></h3></td>
 
13
<td align=right><a href="../../ref/simple_tut/handles.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/simple_tut/open.html"><img src="../../images/next.gif" alt="Next"></a>
 
14
</td></tr></table>
 
15
<p>
 
16
<h1 align=center>Error returns</h1>
 
17
<p>The Berkeley DB interfaces always return a value of 0 on success.  If the
 
18
operation does not succeed for any reason, the return value will be
 
19
non-zero.
 
20
<p>If a system error occurred (for example, Berkeley DB ran out of disk space,
 
21
or permission to access a file was denied, or an illegal argument was
 
22
specified to one of the interfaces), Berkeley DB returns an <b>errno</b>
 
23
value.  All of the possible values of <b>errno</b> are greater than
 
24
0.
 
25
<p>If the operation didn't fail due to a system error, but wasn't
 
26
successful either, Berkeley DB returns a special error value.  For example,
 
27
if you tried to retrieve the data item associated with the key
 
28
<b>fruit</b>, and there was no such key/data pair in the database,
 
29
Berkeley DB would return <a href="../../ref/program/errorret.html#DB_NOTFOUND">DB_NOTFOUND</a>, a special error value that means
 
30
the requested key does not appear in the database.  All of the possible
 
31
special error values are less than 0.
 
32
<p>Berkeley DB also offers programmatic support for displaying error return values.
 
33
First, the <a href="../../api_c/env_strerror.html">db_strerror</a> interface returns a pointer to the error
 
34
message corresponding to any Berkeley DB error return, similar to the ANSI C
 
35
strerror interface, but is able to handle both system error returns and
 
36
Berkeley DB-specific return values.
 
37
<p>Second, there are two error functions, <a href="../../api_c/db_err.html">DB-&gt;err</a> and <a href="../../api_c/db_err.html">DB-&gt;errx</a>.
 
38
These functions work like the ANSI C printf interface, taking a
 
39
printf-style format string and argument list, and optionally appending
 
40
the standard error string to a message constructed from the format string
 
41
and other arguments.
 
42
<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/simple_tut/handles.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/simple_tut/open.html"><img src="../../images/next.gif" alt="Next"></a>
 
43
</td></tr></table>
 
44
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>
 
45
</body>
 
46
</html>