libdb/docs/programmer_reference/sequence.html
2012-11-14 16:35:20 -05:00

88 lines
4.4 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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>Chapter 20.  Sequences</title>
<link rel="stylesheet" href="gettingStarted.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
<link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
<link rel="up" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
<link rel="prev" href="txn_limits.html" title="Transaction limits" />
<link rel="next" href="tcl.html" title="Chapter 21.  Berkeley DB Extensions: Tcl" />
</head>
<body>
<div xmlns="" class="navheader">
<div class="libver">
<p>Library Version 11.2.5.3</p>
</div>
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">Chapter 20. 
Sequences
</th>
</tr>
<tr>
<td width="20%" align="left"><a accesskey="p" href="txn_limits.html">Prev</a> </td>
<th width="60%" align="center"> </th>
<td width="20%" align="right"> <a accesskey="n" href="tcl.html">Next</a></td>
</tr>
</table>
<hr />
</div>
<div class="chapter" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="sequence"></a>Chapter 20. 
Sequences
</h2>
</div>
</div>
</div>
<p>Sequences provide an arbitrary number of persistent objects that return
an increasing or decreasing sequence of integers. Opening a sequence
handle associates it with a record in a database. The handle can
maintain a cache of values from the database so that a database update
is not needed as the application allocates a value.</p>
<p>A sequence is stored as a record pair in a database. The database may
be of any type, but may not have been configured to support duplicate
data items. The sequence is referenced by the key used when the
sequence is created, therefore the key must be compatible with the
underlying access method. If the database stores fixed-length records,
the record size must be at least 64 bytes long.</p>
<p>Since a sequence handle is opened using a database handle, the use of
transactions with the sequence must follow how the database handle was
opened. In other words, if the database handle was opened within a
transaction, operations on the sequence handle must use transactions.
Of course, if sequences are cached, not all operations will actually
trigger a transaction.</p>
<p>For the highest concurrency, caching should be used and the
<a href="../api_reference/C/envset_flags.html#envset_flags_DB_AUTO_COMMIT" class="olink">DB_AUTO_COMMIT</a> and <a href="../api_reference/C/envset_flags.html#envset_flags_DB_TXN_NOSYNC" class="olink">DB_TXN_NOSYNC</a> flags should be
specified to the <a href="../api_reference/C/seqget.html" class="olink">DB_SEQUENCE-&gt;get()</a> method call. If the allocation of the
sequence value must be part of a transaction, and rolled back if the
transaction aborts, then no caching should be specified and the
transaction handle must be passed to the <a href="../api_reference/C/seqget.html" class="olink">DB_SEQUENCE-&gt;get()</a> method.</p>
<p>For more information on the operations supported by the sequence handle, see the <a href="../api_reference/C/seq.html#seqlist" class="olink">Sequences and Related Methods</a> section in the <em class="citetitle">Berkeley DB C API Reference Guide.</em> </p>
</div>
<div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="txn_limits.html">Prev</a> </td>
<td width="20%" align="center"> </td>
<td width="40%" align="right"> <a accesskey="n" href="tcl.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Transaction limits </td>
<td width="20%" align="center">
<a accesskey="h" href="index.html">Home</a>
</td>
<td width="40%" align="right" valign="top"> Chapter 21. 
Berkeley DB Extensions: Tcl
</td>
</tr>
</table>
</div>
</body>
</html>