mirror of
https://github.com/berkeleydb/libdb.git
synced 2024-11-17 01:26:25 +00:00
210 lines
9.1 KiB
HTML
210 lines
9.1 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 get</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_del.html" title="db del" />
|
|||
|
<link rel="next" href="db_get_join.html" title="db get_join" />
|
|||
|
</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> get</th>
|
|||
|
</tr>
|
|||
|
<tr>
|
|||
|
<td width="20%" align="left"><a accesskey="p" href="db_del.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_get_join.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_get"></a><span class="emphasis"><em>db</em></span> get</h2>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<pre class="programlisting">db get
|
|||
|
[-consume]
|
|||
|
[-consume_wait]
|
|||
|
[-glob]
|
|||
|
[-partial {doff dlen}]
|
|||
|
[-recno]
|
|||
|
[-rmw]
|
|||
|
[-txn txnid]
|
|||
|
key
|
|||
|
|
|||
|
db get
|
|||
|
-get_both
|
|||
|
[-partial {doff dlen}]
|
|||
|
[-rmw]
|
|||
|
[-txn txnid]
|
|||
|
key data </pre>
|
|||
|
<p>
|
|||
|
The <span class="emphasis"><em>db</em></span> <span class="bold"><strong>get</strong></span>
|
|||
|
command returns key/data pairs from the database.
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
In the presence of duplicate key values, <span class="emphasis"><em>db</em></span>
|
|||
|
<span class="bold"><strong>get</strong></span> will return all duplicate items.
|
|||
|
Duplicates are sorted by insert order except where this order has been
|
|||
|
overridden by cursor operations.
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
The options are as follows:
|
|||
|
</p>
|
|||
|
<div class="itemizedlist">
|
|||
|
<ul type="disc">
|
|||
|
<li>
|
|||
|
<p>
|
|||
|
<span class="bold"><strong>-consume</strong></span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
Return the record number and data from the available record closest to
|
|||
|
the head of the queue, and delete the record. The cursor will be
|
|||
|
positioned on the deleted record. A record is available if it is not
|
|||
|
deleted and is not currently locked. The underlying database must be
|
|||
|
of type Queue for <span class="bold"><strong>-consume</strong></span> to be
|
|||
|
specified.
|
|||
|
</p>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<p>
|
|||
|
<span class="bold"><strong>-consume_wait</strong></span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
The same as the <span class="bold"><strong>-consume</strong></span> flag except
|
|||
|
that if the Queue database is empty, the thread of control will wait
|
|||
|
until there is data in the queue before returning. The underlying
|
|||
|
database must be of type Queue for <span class="bold"><strong>-consume_wait</strong></span> to be specified.
|
|||
|
</p>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<p>
|
|||
|
<span class="bold"><strong>-get_both key data</strong></span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
Retrieve the key/data pair only if both the key and data match the
|
|||
|
arguments.
|
|||
|
</p>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<p>
|
|||
|
<span class="bold"><strong>-glob</strong></span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
Return all keys matching the given key, where the key is a simple
|
|||
|
wildcard pattern. Where it is used, it replaces the use of the key
|
|||
|
with the given pattern of a set of keys. Any characters after the
|
|||
|
wildcard character are ignored. For example, in a database of last
|
|||
|
names, the command "db0 get Jones" will return all occurrences of
|
|||
|
"Jones" in the database, and the command "db0 get -glob Jo*" will
|
|||
|
return both "Jones" and "Johnson" from the database. The command "db0
|
|||
|
get -glob *" will return all of the key/data pairs in the database.
|
|||
|
This option only works on databases using the Btree access method.
|
|||
|
</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 retrieved
|
|||
|
data record are returned as if they comprised the entire record. If
|
|||
|
any or all of the specified bytes do not exist in the record, the
|
|||
|
command is successful and any existing bytes are returned.
|
|||
|
</p>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<p>
|
|||
|
<span class="bold"><strong>-recno</strong></span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
Retrieve the specified numbered key/data pair from a database. For
|
|||
|
<span class="bold"><strong>-recno</strong></span> to be specified, the specified
|
|||
|
key must be a record number; and the underlying database must be of
|
|||
|
type Recno or Queue, or of type Btree that was created with the
|
|||
|
<span class="bold"><strong>-recnum</strong></span> option.
|
|||
|
</p>
|
|||
|
</li>
|
|||
|
<li>
|
|||
|
<p>
|
|||
|
<span class="bold"><strong>-rmw</strong></span>
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
Acquire write locks instead of read locks when doing the retrieval.
|
|||
|
Setting this flag may decrease the likelihood of deadlock during a
|
|||
|
read-modify-write cycle by immediately acquiring the write lock during
|
|||
|
the read part of the cycle so that another thread of control acquiring
|
|||
|
a read lock for the same item, in its own read-modify-write cycle,
|
|||
|
will not result in deadlock.
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
Because the <span class="emphasis"><em>db</em></span> <span class="bold"><strong>get</strong></span> command will not hold locks across Berkeley
|
|||
|
DB interface calls in nontransactional environments, the <span class="bold"><strong>-rmw</strong></span> argument to the <span class="emphasis"><em>db</em></span>
|
|||
|
<span class="bold"><strong>get</strong></span> call is only meaningful in the
|
|||
|
presence of transactions.
|
|||
|
</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>
|
|||
|
If the underlying database is a Queue or Recno database, 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, unless indicated
|
|||
|
by a given option.
|
|||
|
</p>
|
|||
|
<p>
|
|||
|
A list of key/data pairs is returned. In the error case that no
|
|||
|
matching key exists, an empty list is returned. In all other cases, a
|
|||
|
Tcl error is thrown.
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
<div class="navfooter">
|
|||
|
<hr />
|
|||
|
<table width="100%" summary="Navigation footer">
|
|||
|
<tr>
|
|||
|
<td width="40%" align="left"><a accesskey="p" href="db_del.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_get_join.html">Next</a></td>
|
|||
|
</tr>
|
|||
|
<tr>
|
|||
|
<td width="40%" align="left" valign="top"><span class="emphasis"><em>db</em></span> del </td>
|
|||
|
<td width="20%" align="center">
|
|||
|
<a accesskey="h" href="index.html">Home</a>
|
|||
|
</td>
|
|||
|
<td width="40%" align="right" valign="top"> <span class="emphasis"><em>db</em></span> get_join</td>
|
|||
|
</tr>
|
|||
|
</table>
|
|||
|
</div>
|
|||
|
</body>
|
|||
|
</html>
|