~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to libdb/docs/api_cxx/db_put.html

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!--$Id$-->
2
 
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
3
 
<!--All rights reserved.-->
4
 
<!--See the file LICENSE for redistribution information.-->
5
 
<html>
6
 
<head>
7
 
<title>Berkeley DB: Db::put</title>
8
 
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9
 
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
10
 
</head>
11
 
<body bgcolor=white>
12
 
<a name="2"><!--meow--></a>
13
 
<table width="100%"><tr valign=top>
14
 
<td>
15
 
<h1>Db::put</h1>
16
 
</td>
17
 
<td align=right>
18
 
<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
19
 
</td></tr></table>
20
 
<hr size=1 noshade>
21
 
<tt>
22
 
<h3><pre>
23
 
#include &lt;db_cxx.h&gt;
24
 
<p>
25
 
int
26
 
Db::put(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t flags);
27
 
</pre></h3>
28
 
<h1>Description</h1>
29
 
<p>The Db::put method stores key/data pairs in the database.  The default
30
 
behavior of the Db::put function is to enter the new key/data
31
 
pair, replacing any previously existing key if duplicates are disallowed,
32
 
or adding a duplicate data item if duplicates are allowed.  If the database
33
 
supports duplicates, the Db::put method adds the new data value at the
34
 
end of the duplicate set.  If the database supports sorted duplicates,
35
 
the new data value is inserted at the correct sorted location.
36
 
<p>If the operation is to be transaction-protected (other than by specifying
37
 
the DB_AUTO_COMMIT flag), the <b>txnid</b> parameter is a
38
 
transaction handle returned from <a href="../api_cxx/txn_begin.html">DbEnv::txn_begin</a>; otherwise, NULL.
39
 
<p>The <b>flags</b> value must be set to 0 or
40
 
one of the following values:
41
 
<p><dl compact>
42
 
<p><dt><a name="DB_APPEND">DB_APPEND</a><dd>Append the key/data pair to the end of the database.  For the
43
 
DB_APPEND flag to be specified, the underlying database must be
44
 
a Queue or Recno database.  The record number allocated to the record is
45
 
returned in the specified <b>key</b>.
46
 
<p>There is a minor behavioral difference between the Recno and Queue access
47
 
methods for the DB_APPEND flag.  If a transaction enclosing a
48
 
Db::put operation with the DB_APPEND flag aborts, the
49
 
record number may be decremented (and later reallocated by a subsequent
50
 
DB_APPEND operation) by the Recno access method, but will not be
51
 
decremented or reallocated by the Queue access method.
52
 
<p><dt><a name="DB_NODUPDATA">DB_NODUPDATA</a><dd>In the case of the Btree and Hash access methods, enter the new key/data
53
 
pair only if it does not already appear in the database.  If the
54
 
key/data pair already appears in the database, <a href="../api_cxx/dbc_put.html#DB_KEYEXIST">DB_KEYEXIST</a> is
55
 
returned.  The DB_NODUPDATA flag may only be specified if the
56
 
underlying database has been configured to support sorted duplicates.
57
 
<p>The DB_NODUPDATA flag may not be specified to the Queue or Recno
58
 
access methods.
59
 
<p><dt><a name="DB_NOOVERWRITE">DB_NOOVERWRITE</a><dd>Enter the new key/data pair only if the key does not already appear in
60
 
the database.  If the key already appears in the database,
61
 
<a href="../api_cxx/dbc_put.html#DB_KEYEXIST">DB_KEYEXIST</a> is returned.  Even if the database allows duplicates,
62
 
a call to Db::put with the DB_NOOVERWRITE flag set will
63
 
fail if the key already exists in the database.
64
 
</dl>
65
 
<p>In addition, the following flag may be set by
66
 
bitwise inclusively <b>OR</b>'ing it into the <b>flags</b> parameter:
67
 
<p><dl compact>
68
 
<p><dt><a name="DB_AUTO_COMMIT">DB_AUTO_COMMIT</a><dd>Enclose the Db::put call within a transaction.  If the call succeeds,
69
 
changes made by the operation will be recoverable.  If the call fails,
70
 
the operation will have made no changes.
71
 
</dl>
72
 
<p>
73
 
Otherwise, the Db::put method either returns a non-zero error value or throws an exception that
74
 
encapsulates a non-zero error value on failure, and returns 0 on success.
75
 
<h1>Errors</h1>
76
 
<p>The Db::put method may fail and throw an exception or return a non-zero error for the following conditions:
77
 
<p><dl compact>
78
 
<p><dt>EACCES<dd>An attempt was made to modify a read-only database.
79
 
</dl>
80
 
<p><dl compact>
81
 
<p><dt>EINVAL<dd>An invalid flag value or parameter was specified.
82
 
<p>A record number of 0 was specified.
83
 
<p>An attempt was made to add a record to a fixed-length database that was too
84
 
large to fit.
85
 
<p>An attempt was made to do a partial put.
86
 
<p>An attempt was made to add a record to a secondary index.
87
 
</dl>
88
 
<p><dl compact>
89
 
<p><dt>ENOSPC<dd>A btree exceeded the maximum btree depth (255).
90
 
</dl>
91
 
<p>If the operation was selected to resolve a deadlock, the
92
 
Db::put method will fail and
93
 
and either return <a href="../ref/program/errorret.html#DB_LOCK_DEADLOCK">DB_LOCK_DEADLOCK</a> or
94
 
throw a <a href="../api_cxx/deadlock_class.html">DbDeadlockException</a> exception.
95
 
<p>The Db::put method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods.
96
 
If a catastrophic error has occurred, the Db::put method may fail and
97
 
either return <a href="../ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a> or throw a
98
 
<a href="../api_cxx/runrec_class.html">DbRunRecoveryException</a>,
99
 
in which case all subsequent Berkeley DB calls will fail in the same way.
100
 
<h1>Class</h1>
101
 
<a href="../api_cxx/db_class.html">Db</a>
102
 
<h1>See Also</h1>
103
 
<a href="../api_cxx/db_list.html">Databases and Related Methods</a>
104
 
</tt>
105
 
<table width="100%"><tr><td><br></td><td align=right>
106
 
<a href="../api_cxx/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
107
 
</td></tr></table>
108
 
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>
109
 
</body>
110
 
</html>