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