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