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