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

« back to all changes in this revision

Viewing changes to libdb/docs/api_java/dbc_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: Dbc.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>Dbc.put</h1>
16
 
</td>
17
 
<td align=right>
18
 
<a href="../api_java/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
 
import com.sleepycat.db.*;
24
 
<p>
25
 
public void put(Dbt key, Dbt data, int flags)
26
 
    throws DbException;
27
 
</pre></h3>
28
 
<h1>Description</h1>
29
 
<p>The Dbc.put method stores key/data pairs into the database.
30
 
<p>The <b>flags</b> value must be set to one of the following values:
31
 
<p><dl compact>
32
 
<p><dt><a name="Db.DB_AFTER">Db.DB_AFTER</a><dd>In the case of the Btree and Hash access methods, insert the data
33
 
element as a duplicate element of the key to which the cursor refers.
34
 
The new element appears immediately after the current cursor position.
35
 
It is an error to specify Db.DB_AFTER if the underlying Btree or
36
 
Hash database does not support duplicate data items.  The <b>key</b>
37
 
parameter is ignored.
38
 
<p>In the case of the Recno access method, it is an error to specify
39
 
Db.DB_AFTER if the underlying Recno database was not created with
40
 
the <a href="../api_java/db_set_flags.html#DB_RENUMBER">Db.DB_RENUMBER</a> flag.  If the <a href="../api_java/db_set_flags.html#DB_RENUMBER">Db.DB_RENUMBER</a> flag was
41
 
specified, a new key is created, all records after the inserted item
42
 
are automatically renumbered, and the key of the new record is returned
43
 
in the structure to which the <b>key</b> argument refers.  The initial
44
 
value of the <b>key</b> parameter is ignored.  See <a href="../api_java/db_open.html">Db.open</a>
45
 
for more information.
46
 
<p>The Db.DB_AFTER flag may not be specified to the Queue access method.
47
 
<p>If the current cursor record has already been deleted and the underlying
48
 
access method is Hash, Dbc.put will return <a href="../ref/program/errorret.html#DB_NOTFOUND">Db.DB_NOTFOUND</a>.
49
 
If the underlying access method is Btree or Recno, the operation will
50
 
succeed.
51
 
<p>If the cursor is not yet initialized or if a duplicate sort function
52
 
has been specified, the Dbc.put function will return EINVAL.
53
 
<p><dt><a name="Db.DB_BEFORE">Db.DB_BEFORE</a><dd>In the case of the Btree and Hash access methods, insert the data
54
 
element as a duplicate element of the key to which the cursor refers.
55
 
The new element appears immediately before the current cursor position.
56
 
It is an error to specify Db.DB_BEFORE if the underlying Btree or
57
 
Hash database does not support duplicate data items.  The <b>key</b>
58
 
parameter is ignored.
59
 
<p>In the case of the Recno access method, it is an error to specify
60
 
Db.DB_BEFORE if the underlying Recno database was not created with
61
 
the <a href="../api_java/db_set_flags.html#DB_RENUMBER">Db.DB_RENUMBER</a> flag.  If the <a href="../api_java/db_set_flags.html#DB_RENUMBER">Db.DB_RENUMBER</a> flag was
62
 
specified, a new key is created, the current record and all records
63
 
after it are automatically renumbered, and the key of the new record is
64
 
returned in the structure to which the <b>key</b> argument refers.
65
 
The initial value of the <b>key</b> parameter is ignored.  See
66
 
<a href="../api_java/db_open.html">Db.open</a> for more information.
67
 
<p>The Db.DB_BEFORE flag may not be specified to the Queue access method.
68
 
<p>If the current cursor record has already been deleted and the underlying
69
 
access method is Hash, Dbc.put will return <a href="../ref/program/errorret.html#DB_NOTFOUND">Db.DB_NOTFOUND</a>.
70
 
If the underlying access method is Btree or Recno, the operation will
71
 
succeed.
72
 
<p>If the cursor is not yet initialized or if a duplicate sort function
73
 
has been specified, Dbc.put will return EINVAL.
74
 
<p><dt><a name="Db.DB_CURRENT">Db.DB_CURRENT</a><dd>Overwrite the data of the key/data pair to which the cursor refers with
75
 
the specified data item.  The <b>key</b> parameter is ignored.
76
 
<p>If a duplicate sort function has been specified and the data item of the
77
 
referenced key/data pair does not compare equally to the <b>data</b>
78
 
parameter, Dbc.put will return EINVAL.
79
 
<p>If the current cursor record has already been deleted and the underlying
80
 
access method is Hash, Dbc.put will return <a href="../ref/program/errorret.html#DB_NOTFOUND">Db.DB_NOTFOUND</a>.
81
 
If the underlying access method is Btree, Queue, or Recno, the operation
82
 
will succeed.
83
 
<p>If the cursor is not yet initialized, Dbc.put will return EINVAL.
84
 
<p><dt><a name="Db.DB_KEYFIRST">Db.DB_KEYFIRST</a><dd>In the case of the Btree and Hash access methods, insert the specified
85
 
key/data pair into the database.
86
 
<p>If the underlying database supports duplicate data items, and if the
87
 
key already exists in the database and a duplicate sort function has
88
 
been specified, the inserted data item is added in its sorted location.
89
 
If the key already exists in the database and no duplicate sort function
90
 
has been specified, the inserted data item is added as the first of the
91
 
data items for that key.
92
 
<p>The Db.DB_KEYFIRST flag may not be specified to the Queue or Recno
93
 
access methods.
94
 
<p><dt><a name="Db.DB_KEYLAST">Db.DB_KEYLAST</a><dd>In the case of the Btree and Hash access methods, insert the specified
95
 
key/data pair into the database.
96
 
<p>If the underlying database supports duplicate data items, and if the
97
 
key already exists in the database and a duplicate sort function has
98
 
been specified, the inserted data item is added in its sorted location.
99
 
If the key already exists in the database, and no duplicate sort
100
 
function has been specified, the inserted data item is added as the last
101
 
of the data items for that key.
102
 
<p>The Db.DB_KEYLAST flag may not be specified to the Queue or Recno
103
 
access methods.
104
 
<p><dt><a name="Db.DB_NODUPDATA">Db.DB_NODUPDATA</a><dd>In the case of the Btree and Hash access methods, insert the specified
105
 
key/data pair into the database, unless it already exists in the database.
106
 
If the key/data pair already appears in the database, <a href="../api_java/dbc_put.html#DB_KEYEXIST">Db.DB_KEYEXIST</a>
107
 
is returned.  The Db.DB_NODUPDATA flag may only be specified if
108
 
the underlying database has been configured to support sorted duplicate
109
 
data items.
110
 
<p>The Db.DB_NODUPDATA flag may not be specified to the Queue or Recno
111
 
access methods.
112
 
</dl>
113
 
<p>
114
 
Otherwise, the Dbc.put method throws an exception that encapsulates a non-zero error value on
115
 
failure.
116
 
<p>If Dbc.put fails for any reason, the state of the cursor will be
117
 
unchanged.  If Dbc.put succeeds and an item is inserted into the
118
 
database, the cursor is always positioned to refer to the newly inserted
119
 
item.
120
 
<h1>Errors</h1>
121
 
<p>The Dbc.put method may fail and throw an exception encapsulating a non-zero error for the following conditions:
122
 
<p><dl compact>
123
 
<p><dt>EACCES<dd>An attempt was made to modify a read-only database.
124
 
</dl>
125
 
<p><dl compact>
126
 
<p><dt>EINVAL<dd>An invalid flag value or parameter was specified.
127
 
<p>The Db.DB_BEFORE or Db.DB_AFTER flags were specified, and the
128
 
underlying access method is Queue.
129
 
<p>An attempt was made to add a record to a fixed-length database that was too
130
 
large to fit.
131
 
<p>An attempt was made to add a record to a secondary index.
132
 
</dl>
133
 
<p><dl compact>
134
 
<p><dt>EPERM  <dd>Write attempted on read-only cursor when the <a href="../api_java/env_open.html#DB_INIT_CDB">Db.DB_INIT_CDB</a> flag was
135
 
specified to <a href="../api_java/env_open.html">DbEnv.open</a>.
136
 
</dl>
137
 
<p>If the operation was selected to resolve a deadlock, the
138
 
Dbc.put method will fail and
139
 
throw a <a href="../api_java/deadlock_class.html">DbDeadlockException</a> exception.
140
 
<p>The Dbc.put method may fail and throw an exception for errors specified for other Berkeley DB and C library or system methods.
141
 
If a catastrophic error has occurred, the Dbc.put method may fail and
142
 
throw a <a href="../api_java/runrec_class.html">DbRunRecoveryException</a>,
143
 
in which case all subsequent Berkeley DB calls will fail in the same way.
144
 
<h1>Class</h1>
145
 
<a href="../api_java/dbc_class.html">Dbc</a>
146
 
<h1>See Also</h1>
147
 
<a href="../api_java/dbc_list.html">Database Cursors and Related Methods</a>
148
 
</tt>
149
 
<table width="100%"><tr><td><br></td><td align=right>
150
 
<a href="../api_java/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
151
 
</td></tr></table>
152
 
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>
153
 
</body>
154
 
</html>