| 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 6 | <title>Chapter 20. Sequences</title> |
| 7 | <link rel="stylesheet" href="gettingStarted.css" type="text/css" /> |
| 8 | <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> |
| 9 | <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" /> |
| 10 | <link rel="up" href="index.html" title="Berkeley DB Programmer's Reference Guide" /> |
| 11 | <link rel="prev" href="txn_limits.html" title="Transaction limits" /> |
| 12 | <link rel="next" href="tcl.html" title="Chapter 21. Berkeley DB Extensions: Tcl" /> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">Chapter 20. |
| 22 | Sequences |
| 23 | </th> |
| 24 | </tr> |
| 25 | <tr> |
| 26 | <td width="20%" align="left"><a accesskey="p" href="txn_limits.html">Prev</a> </td> |
| 27 | <th width="60%" align="center"> </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="tcl.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="chapter" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title"><a id="sequence"></a>Chapter 20. |
| 38 | Sequences |
| 39 | </h2> |
| 40 | </div> |
| 41 | </div> |
| 42 | </div> |
| 43 | <p>Sequences provide an arbitrary number of persistent objects that return |
| 44 | an increasing or decreasing sequence of integers. Opening a sequence |
| 45 | handle associates it with a record in a database. The handle can |
| 46 | maintain a cache of values from the database so that a database update |
| 47 | is not needed as the application allocates a value.</p> |
| 48 | <p>A sequence is stored as a record pair in a database. The database may |
| 49 | be of any type, but may not have been configured to support duplicate |
| 50 | data items. The sequence is referenced by the key used when the |
| 51 | sequence is created, therefore the key must be compatible with the |
| 52 | underlying access method. If the database stores fixed-length records, |
| 53 | the record size must be at least 64 bytes long.</p> |
| 54 | <p>Since a sequence handle is opened using a database handle, the use of |
| 55 | transactions with the sequence must follow how the database handle was |
| 56 | opened. In other words, if the database handle was opened within a |
| 57 | transaction, operations on the sequence handle must use transactions. |
| 58 | Of course, if sequences are cached, not all operations will actually |
| 59 | trigger a transaction.</p> |
| 60 | <p>For the highest concurrency, caching should be used and the |
| 61 | <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 |
| 62 | specified to the <a href="../api_reference/C/seqget.html" class="olink">DB_SEQUENCE->get()</a> method call. If the allocation of the |
| 63 | sequence value must be part of a transaction, and rolled back if the |
| 64 | transaction aborts, then no caching should be specified and the |
| 65 | transaction handle must be passed to the <a href="../api_reference/C/seqget.html" class="olink">DB_SEQUENCE->get()</a> method.</p> |
| 66 | <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> |
| 67 | </div> |
| 68 | <div class="navfooter"> |
| 69 | <hr /> |
| 70 | <table width="100%" summary="Navigation footer"> |
| 71 | <tr> |
| 72 | <td width="40%" align="left"><a accesskey="p" href="txn_limits.html">Prev</a> </td> |
| 73 | <td width="20%" align="center"> </td> |
| 74 | <td width="40%" align="right"> <a accesskey="n" href="tcl.html">Next</a></td> |
| 75 | </tr> |
| 76 | <tr> |
| 77 | <td width="40%" align="left" valign="top">Transaction limits </td> |
| 78 | <td width="20%" align="center"> |
| 79 | <a accesskey="h" href="index.html">Home</a> |
| 80 | </td> |
| 81 | <td width="40%" align="right" valign="top"> Chapter 21. |
| 82 | Berkeley DB Extensions: Tcl |
| 83 | </td> |
| 84 | </tr> |
| 85 | </table> |
| 86 | </div> |
| 87 | </body> |
| 88 | </html> |