mirror of
https://github.com/berkeleydb/libdb.git
synced 2024-11-17 01:26:25 +00:00
154 lines
6.7 KiB
HTML
154 lines
6.7 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||
<title>db put</title>
|
||
<link rel="stylesheet" href="apiReference.css" type="text/css" />
|
||
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
|
||
<link rel="start" href="index.html" title="Berkeley DB TCL API Reference" />
|
||
<link rel="up" href="tclapi.html" title="Chapter 1. Berkeley DB Tcl APIs" />
|
||
<link rel="prev" href="db_open.html" title="berkdb open" />
|
||
<link rel="next" href="db_remove.html" title="berkdb dbremove" />
|
||
</head>
|
||
<body>
|
||
<div xmlns="" class="navheader">
|
||
<div class="libver">
|
||
<p>Library Version 11.2.5.2</p>
|
||
</div>
|
||
<table width="100%" summary="Navigation header">
|
||
<tr>
|
||
<th colspan="3" align="center"><span xmlns="http://www.w3.org/1999/xhtml" class="emphasis"><em>db</em></span> put</th>
|
||
</tr>
|
||
<tr>
|
||
<td width="20%" align="left"><a accesskey="p" href="db_open.html">Prev</a> </td>
|
||
<th width="60%" align="center">Chapter 1.
|
||
Berkeley DB Tcl APIs
|
||
</th>
|
||
<td width="20%" align="right"> <a accesskey="n" href="db_remove.html">Next</a></td>
|
||
</tr>
|
||
</table>
|
||
<hr />
|
||
</div>
|
||
<div class="sect1" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h2 class="title" style="clear: both"><a id="db_put"></a><span class="emphasis"><em>db</em></span> put</h2>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<pre class="programlisting">db put
|
||
-append
|
||
[-partial {doff dlen}]
|
||
[-txn txnid]
|
||
data
|
||
|
||
db put
|
||
[-nooverwrite]
|
||
[-partial {doff dlen}]
|
||
[-txn txnid]
|
||
key data </pre>
|
||
<p>
|
||
The <span class="emphasis"><em>db</em></span> <span class="bold"><strong>put</strong></span>
|
||
command stores the specified key/data pair into the database.
|
||
</p>
|
||
<p>
|
||
The options are as follows:
|
||
</p>
|
||
<div class="itemizedlist">
|
||
<ul type="disc">
|
||
<li>
|
||
<p>
|
||
<span class="bold"><strong>-append</strong></span>
|
||
</p>
|
||
<p>
|
||
Append the data item to the end of the database. For the <span class="bold"><strong>-append</strong></span> option to be specified, the underlying
|
||
database must be a Queue or Recno database. The record number
|
||
allocated to the record is returned on success.
|
||
</p>
|
||
</li>
|
||
<li>
|
||
<p>
|
||
<span class="bold"><strong>-nooverwrite</strong></span>
|
||
</p>
|
||
<p>
|
||
Enter the new key/data pair only if the key does not already appear in
|
||
the database.
|
||
</p>
|
||
</li>
|
||
<li>
|
||
<p>
|
||
<span class="bold"><strong>-partial {doff dlen}</strong></span>
|
||
</p>
|
||
<p>
|
||
The <span class="bold"><strong>dlen</strong></span> bytes starting <span class="bold"><strong>doff</strong></span> bytes from the beginning of the specified
|
||
key's data record are replaced by the data specified by the data and
|
||
size structure elements. If <span class="bold"><strong>dlen</strong></span> is
|
||
smaller than the length of the supplied data, the record will grow; if
|
||
<span class="bold"><strong>dlen</strong></span> is larger than the length of the
|
||
supplied data, the record will shrink. If the specified bytes do not
|
||
exist, the record will be extended using nul bytes as necessary, and
|
||
the <span class="emphasis"><em>db</em></span> <span class="bold"><strong>put</strong></span> call
|
||
will succeed.
|
||
</p>
|
||
<p>
|
||
It is an error to attempt a partial put using the
|
||
<span class="emphasis"><em>db</em></span> <span class="bold"><strong>put</strong></span> command
|
||
in a database that supports duplicate records. Partial puts in
|
||
databases supporting duplicate records must be done using a
|
||
<span class="emphasis"><em>dbc</em></span> <span class="bold"><strong>put</strong></span> command.
|
||
</p>
|
||
<p>
|
||
It is an error to attempt a partial put with differing <span class="bold"><strong>dlen</strong></span> and supplied data length values in Queue
|
||
or Recno databases with fixed-length records.
|
||
</p>
|
||
</li>
|
||
<li>
|
||
<p>
|
||
<span class="bold"><strong>-txn txnid</strong></span>
|
||
</p>
|
||
<p>
|
||
If the operation is part of an application-specified transaction, the
|
||
<span class="bold"><strong>txnid</strong></span> parameter is a transaction
|
||
handle returned from <span class="emphasis"><em>env</em></span> <span class="bold"><strong>txn</strong></span>. If no transaction handle is specified,
|
||
but the operation occurs in a transactional database, the operation
|
||
will be implicitly transaction protected.
|
||
</p>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<p>
|
||
The <span class="emphasis"><em>db</em></span> <span class="bold"><strong>put</strong></span>
|
||
command returns either 0 or a record number for success (the record
|
||
number is returned if the <span class="bold"><strong>-append</strong></span>
|
||
option was specified). If an error occurs, a Berkeley DB error message
|
||
is returned or a Tcl error is thrown.
|
||
</p>
|
||
<p>
|
||
If the underlying database is a Queue or Recno database, then the
|
||
given key will be interpreted by Tcl as an integer. For all other
|
||
database types, the key is interpreted by Tcl as a byte array.
|
||
</p>
|
||
</div>
|
||
<div class="navfooter">
|
||
<hr />
|
||
<table width="100%" summary="Navigation footer">
|
||
<tr>
|
||
<td width="40%" align="left"><a accesskey="p" href="db_open.html">Prev</a> </td>
|
||
<td width="20%" align="center">
|
||
<a accesskey="u" href="tclapi.html">Up</a>
|
||
</td>
|
||
<td width="40%" align="right"> <a accesskey="n" href="db_remove.html">Next</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td width="40%" align="left" valign="top">berkdb open </td>
|
||
<td width="20%" align="center">
|
||
<a accesskey="h" href="index.html">Home</a>
|
||
</td>
|
||
<td width="40%" align="right" valign="top"> berkdb dbremove</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</body>
|
||
</html>
|