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>DbSequence::open()</title> 7 <link rel="stylesheet" href="apiReference.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 C++ API Reference" /> 10 <link rel="up" href="seq.html" title="Chapter 12. The DbSequence Handle" /> 11 <link rel="prev" href="seqinitial_value.html" title="DbSequence::initial_value()" /> 12 <link rel="next" href="seqremove.html" title="DbSequence::remove()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbSequence::open()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="seqinitial_value.html">Prev</a> </td> 22 <th width="60%" align="center">Chapter 12. 23 The DbSequence Handle 24 </th> 25 <td width="20%" align="right"> <a accesskey="n" href="seqremove.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="seqopen"></a>DbSequence::open()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbSequence::open(DbTxn *txnid, Dbt *key, u_int32_t flags); </pre> 42 <p> 43 The <code class="methodname">DbSequence::open()</code> method opens the sequence represented by the 44 <span class="bold"><strong>key</strong></span>. The key must be compatible with 45 the underlying database specified in the corresponding call to 46 <a class="xref" href="seqcreate.html" title="DbSequence">DbSequence</a>. 47 </p> 48 <p> 49 The <code class="methodname">DbSequence::open()</code> <span> 50 51 <span> 52 method either returns a non-zero error value or throws an 53 exception that encapsulates a non-zero error value on 54 failure, and returns 0 on success. 55 </span> 56 </span> 57 </p> 58 <div class="sect2" lang="en" xml:lang="en"> 59 <div class="titlepage"> 60 <div> 61 <div> 62 <h3 class="title"><a id="id1710321"></a>Parameters</h3> 63 </div> 64 </div> 65 </div> 66 <div class="sect3" lang="en" xml:lang="en"> 67 <div class="titlepage"> 68 <div> 69 <div> 70 <h4 class="title"><a id="id1710403"></a>key</h4> 71 </div> 72 </div> 73 </div> 74 <p> 75 The <span class="bold"><strong>key</strong></span> specifies which record in the 76 database stores the persistent sequence data. 77 </p> 78 </div> 79 <div class="sect3" lang="en" xml:lang="en"> 80 <div class="titlepage"> 81 <div> 82 <div> 83 <h4 class="title"><a id="id1710379"></a>flags</h4> 84 </div> 85 </div> 86 </div> 87 <p> 88 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0 89 or by bitwise inclusively <span class="bold"><strong>OR</strong></span>'ing 90 together one or more of the following values: 91 </p> 92 <div class="itemizedlist"> 93 <ul type="disc"> 94 <li> 95 <p> 96 <code class="literal">DB_CREATE</code> 97 </p> 98 <p> 99 Create the sequence. If the sequence does not already exist and the 100 <code class="literal">DB_CREATE</code> flag is not specified, the 101 <code class="methodname">DbSequence::open()</code> method will fail. 102 </p> 103 </li> 104 <li> 105 <p> 106 <code class="literal">DB_EXCL</code> 107 </p> 108 <p> 109 Return an error if the sequence already exists. This flag is only 110 meaningful when specified with the <code class="literal">DB_CREATE</code> flag. 111 </p> 112 </li> 113 <li> 114 <p><a id="seqopen_DB_THREAD"></a> 115 <code class="literal">DB_THREAD</code> 116 </p> 117 <p> 118 Cause the <a class="link" href="seq.html" title="Chapter 12. The DbSequence Handle">DbSequence</a> 119 handle returned by <code class="methodname">DbSequence::open()</code> to be 120 <span class="emphasis"><em>free-threaded</em></span>; that is, usable by multiple 121 threads within a single address space. Note that if multiple threads 122 create multiple sequences using the same database handle that handle 123 must have been opened specifying this flag. 124 </p> 125 </li> 126 </ul> 127 </div> 128 </div> 129 <div class="sect3" lang="en" xml:lang="en"> 130 <div class="titlepage"> 131 <div> 132 <div> 133 <h4 class="title"><a id="id1710820"></a>txnid</h4> 134 </div> 135 </div> 136 </div> 137 <p> 138 If the operation is part of an application-specified transaction, the 139 <span class="bold"><strong>txnid</strong></span> parameter is a transaction 140 handle returned from <a class="xref" href="txnbegin.html" title="DbEnv::txn_begin()">DbEnv::txn_begin()</a>; if the 141 operation is part of a Berkeley DB Concurrent Data Store group, the 142 <span class="bold"><strong>txnid</strong></span> parameter is a handle returned 143 from <a class="xref" href="envcdsgroup_begin.html" title="DbEnv::cdsgroup_begin()">DbEnv::cdsgroup_begin()</a>; 144 otherwise NULL. If no transaction handle is specified, but the 145 operation occurs in a transactional database, the operation will be 146 implicitly transaction protected. Transactionally protected operations 147 on a <a class="link" href="seq.html" title="Chapter 12. The DbSequence Handle">DbSequence</a> handle 148 require the <a class="link" href="seq.html" title="Chapter 12. The DbSequence Handle">DbSequence</a> 149 handle itself be transactionally protected during its open if the open 150 creates the sequence. 151 </p> 152 </div> 153 </div> 154 <div class="sect2" lang="en" xml:lang="en"> 155 <div class="titlepage"> 156 <div> 157 <div> 158 <h3 class="title"><a id="id1710782"></a>Class</h3> 159 </div> 160 </div> 161 </div> 162 <p> 163 <a class="link" href="seq.html" title="Chapter 12. The DbSequence Handle">DbSequence</a> 164 </p> 165 </div> 166 <div class="sect2" lang="en" xml:lang="en"> 167 <div class="titlepage"> 168 <div> 169 <div> 170 <h3 class="title"><a id="id1710833"></a>See Also</h3> 171 </div> 172 </div> 173 </div> 174 <p> 175 <a class="xref" href="seq.html#seqlist" title="Sequences and Related Methods">Sequences and Related Methods</a> 176 </p> 177 </div> 178 </div> 179 <div class="navfooter"> 180 <hr /> 181 <table width="100%" summary="Navigation footer"> 182 <tr> 183 <td width="40%" align="left"><a accesskey="p" href="seqinitial_value.html">Prev</a> </td> 184 <td width="20%" align="center"> 185 <a accesskey="u" href="seq.html">Up</a> 186 </td> 187 <td width="40%" align="right"> <a accesskey="n" href="seqremove.html">Next</a></td> 188 </tr> 189 <tr> 190 <td width="40%" align="left" valign="top">DbSequence::initial_value() </td> 191 <td width="20%" align="center"> 192 <a accesskey="h" href="index.html">Home</a> 193 </td> 194 <td width="40%" align="right" valign="top"> DbSequence::remove()</td> 195 </tr> 196 </table> 197 </div> 198 </body> 199</html> 200