Sophie

Sophie

distrib > PLD > th > x86_64 > by-pkgid > 56df4fd64837349895bc16cb1a24c6bc > files > 654

db4.7-apidocs-4.7.25.4-10.noarch.rpm

<!--$Id: intro.so,v 1.5 2006/11/13 18:05:03 bostic Exp $-->
<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB Reference Guide: Introduction to sequences</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<a name="2"><!--meow--></a>
<table width="100%"><tr valign=top>
<td><b><dl><dt>Berkeley DB Reference Guide:<dd>Sequences</dl></b></td>
<td align=right><a href="../txn/limits.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../rpc/intro.html"><img src="../../images/next.gif" alt="Next"></a>
</td></tr></table>
<p align=center><b>Introduction to sequences</b></p>
<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_c/env_set_flags.html#DB_AUTO_COMMIT">DB_AUTO_COMMIT</a> and <a href="../../api_c/env_set_flags.html#DB_TXN_NOSYNC">DB_TXN_NOSYNC</a> flags should be
specified to the <a href="../../api_c/seq_get.html">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_c/seq_get.html">DB_SEQUENCE-&gt;get</a> method.</p>
<!--$Id: m4.methods,v 1.7 2004/11/29 15:34:22 bostic Exp $-->
<table border=1 align=center>
<tr><th>Sequences and Related Methods</th><th>Description</th></tr>
<!--DbSequence::--><tr><td><a href="../../api_c/seq_class.html">db_sequence_create</a></td><td>Create a sequence handle</td></tr>
<!--DbSequence::close--><tr><td><a href="../../api_c/seq_close.html">DB_SEQUENCE-&gt;close</a></td><td>Close a sequence</td></tr>
<!--DbSequence::get--><tr><td><a href="../../api_c/seq_get.html">DB_SEQUENCE-&gt;get</a></td><td>Get the next sequence element(s)</td></tr>
<!--DbSequence::get_dbp--><tr><td><a href="../../api_c/seq_open.html">DB_SEQUENCE-&gt;get_dbp</a></td><td>Return a handle for the underlying sequence database</td></tr>
<!--DbSequence::get_key--><tr><td><a href="../../api_c/seq_open.html">DB_SEQUENCE-&gt;get_key</a></td><td>Return the key for a sequence</td></tr>
<!--DbSequence::initial_value--><tr><td><a href="../../api_c/seq_initial_value.html">DB_SEQUENCE-&gt;initial_value</a></td><td>Set the initial value of a sequence</td></tr>
<!--DbSequence::open--><tr><td><a href="../../api_c/seq_open.html">DB_SEQUENCE-&gt;open</a></td><td>Open a sequence</td></tr>
<!--DbSequence::remove--><tr><td><a href="../../api_c/seq_remove.html">DB_SEQUENCE-&gt;remove</a></td><td>Remove a sequence</td></tr>
<!--DbSequence::stat--><tr><td><a href="../../api_c/seq_stat.html">DB_SEQUENCE-&gt;stat</a></td><td>Return sequence statistics</td></tr>
<tr><th>Sequences Configuration</th><th><br></th></tr>
<!--DbSequence::set_cachesize--><tr><td><a href="../../api_c/seq_set_cachesize.html">DB_SEQUENCE-&gt;set_cachesize</a></td><td>Set the cache size of a sequence</td></tr>
<!--DbSequence::set_flags--><tr><td><a href="../../api_c/seq_set_flags.html">DB_SEQUENCE-&gt;set_flags</a></td><td>Set the flags for a sequence</td></tr>
<!--DbSequence::set_range--><tr><td><a href="../../api_c/seq_set_range.html">DB_SEQUENCE-&gt;set_range</a></td><td>Set the range for a sequence</td></tr>
</table>
<table width="100%"><tr><td><br></td><td align=right><a href="../txn/limits.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../rpc/intro.html"><img src="../../images/next.gif" alt="Next"></a>
</td></tr></table>
<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
</body>
</html>