Debian Codegraph @

docs/api_reference/C/seqget.html

raw symbols SCIP
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-&gt;get()</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="seqclose.html" title="DB_SEQUENCE-&gt;close()" />
12 <link rel="next" href="seqget_cachesize.html" title="DB_SEQUENCE-&gt;get_cachesize()" />
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-&gt;get()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="seqclose.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="seqget_cachesize.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="seqget"></a>DB_SEQUENCE-&gt;get()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB_SEQUENCE-&gt;get(DB_SEQUENCE *seq,
45 DB_TXN *txnid, int32_t delta, db_seq_t *retp, u_int32_t flags); </pre>
46 <p>
47 The <code class="methodname">DB_SEQUENCE-&gt;get()</code> method returns the next available element in
48 the sequence and changes the sequence value by <span class="bold"><strong>delta</strong></span>. The value of <span class="bold"><strong>delta</strong></span> must be greater than zero. If there are
49 enough cached values in the sequence handle then they will be
50 returned. Otherwise the next value will be fetched from the database
51 and incremented (decremented) by enough to cover the <span class="bold"><strong>delta</strong></span> and the next batch of cached values.
52 </p>
53 <p>
54 For maximum concurrency a non-zero cache size should be specified
55 prior to opening the sequence handle and
56 <a class="link" href="envset_flags.html#envset_flags_DB_TXN_NOSYNC">DB_TXN_NOSYNC</a>
57 should be specified for each <code class="methodname">DB_SEQUENCE-&gt;get()</code> method call.
58 </p>
59 <p>
60 By default, sequence ranges do not wrap; to cause the sequence to wrap
61 around the beginning or end of its range, specify the
62 <a class="link" href="seqset_flags.html#seqset_flags_DB_SEQ_WRAP">DB_SEQ_WRAP</a>
63 flag to the <a class="xref" href="seqset_flags.html" title="DB_SEQUENCE-&gt;set_flags()">DB_SEQUENCE-&gt;set_flags()</a>
64 method.
65 </p>
66 <p>
67 The <code class="methodname">DB_SEQUENCE-&gt;get()</code> method will return EINVAL if the record in the
68 database is not a valid sequence record, or the sequence has reached
69 the beginning or end of its range and is not configured to wrap.
70 </p>
71 <div class="sect2" lang="en" xml:lang="en">
72 <div class="titlepage">
73 <div>
74 <div>
75 <h3 class="title"><a id="idp54587600"></a>Parameters</h3>
76 </div>
77 </div>
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="idp54587792"></a>txnid</h4>
84 </div>
85 </div>
86 </div>
87 <p>
88 If the operation is part of an application-specified transaction, the
89 <span class="bold"><strong>txnid</strong></span> parameter is a transaction
90 handle returned from <a class="xref" href="txnbegin.html" title="DB_ENV-&gt;txn_begin()">DB_ENV-&gt;txn_begin()</a>; if the
91 operation is part of a Berkeley DB Concurrent Data Store group, the
92 <span class="bold"><strong>txnid</strong></span> parameter is a handle returned
93 from <a class="xref" href="envcdsgroup_begin.html" title="DB_ENV-&gt;cdsgroup_begin()">DB_ENV-&gt;cdsgroup_begin()</a>;
94 otherwise NULL. If no transaction handle is specified, but the
95 operation occurs in a transactional database, the operation will be
96 implicitly transaction protected. No <span class="bold"><strong>txnid</strong></span> handle may be specified if the sequence
97 handle was opened with a non-zero cache size.
98 </p>
99 <p>
100 If the underlying database handle was opened in a transaction, calling
101 <code class="methodname">DB_SEQUENCE-&gt;get()</code> may result in changes to the sequence object;
102 these changes will be automatically committed in a transaction
103 internal to the Berkeley DB library. If the thread of control calling
104 <code class="methodname">DB_SEQUENCE-&gt;get()</code> has an active transaction, which holds locks on
105 the same database as the one in which the sequence object is stored,
106 it is possible for a thread of control calling <code class="methodname">DB_SEQUENCE-&gt;get()</code> to
107 self-deadlock because the active transaction's locks conflict with the
108 internal transaction's locks. For this reason, it is often preferable
109 for sequence objects to be stored in their own database.
110 </p>
111 </div>
112 <div class="sect3" lang="en" xml:lang="en">
113 <div class="titlepage">
114 <div>
115 <div>
116 <h4 class="title"><a id="idp54530312"></a>delta</h4>
117 </div>
118 </div>
119 </div>
120 <p>
121 Specifies the amount to increment or decrement the sequence.
122 </p>
123 </div>
124 <div class="sect3" lang="en" xml:lang="en">
125 <div class="titlepage">
126 <div>
127 <div>
128 <h4 class="title"><a id="idp54598976"></a>retp</h4>
129 </div>
130 </div>
131 </div>
132 <p>
133 <span class="bold"><strong>retp</strong></span> points to the memory to hold the
134 return value from the sequence.
135 </p>
136 </div>
137 <div class="sect3" lang="en" xml:lang="en">
138 <div class="titlepage">
139 <div>
140 <div>
141 <h4 class="title"><a id="idp54585448"></a>flags</h4>
142 </div>
143 </div>
144 </div>
145 <p>
146 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
147 or by bitwise inclusively <span class="bold"><strong>OR</strong></span>'ing
148 together one or more of the following values:
149 </p>
150 <div class="itemizedlist">
151 <ul type="disc">
152 <li>
153 <p>
154 <code class="literal">DB_TXN_NOSYNC</code>
155 </p>
156 <p>
157 If the operation is implicitly transaction protected (the <span class="bold"><strong>txnid</strong></span> argument is NULL but the operation occurs
158 to a transactional database), do not synchronously flush the log when
159 the transaction commits.
160 </p>
161 </li>
162 </ul>
163 </div>
164 </div>
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="idp54594624"></a>Class</h3>
171 </div>
172 </div>
173 </div>
174 <p>
175 <a class="link" href="seq.html" title="Chapter 11.  The DB_SEQUENCE Handle">DB_SEQUENCE</a>
176 </p>
177 </div>
178 <div class="sect2" lang="en" xml:lang="en">
179 <div class="titlepage">
180 <div>
181 <div>
182 <h3 class="title"><a id="idp54590448"></a>See Also</h3>
183 </div>
184 </div>
185 </div>
186 <p>
187 <a class="xref" href="seq.html#seqlist" title="Sequences and Related Methods">Sequences and Related Methods</a>
188 </p>
189 </div>
190 </div>
191 <div class="navfooter">
192 <hr />
193 <table width="100%" summary="Navigation footer">
194 <tr>
195 <td width="40%" align="left"><a accesskey="p" href="seqclose.html">Prev</a> </td>
196 <td width="20%" align="center">
197 <a accesskey="u" href="seq.html">Up</a>
198 </td>
199 <td width="40%" align="right"> <a accesskey="n" href="seqget_cachesize.html">Next</a></td>
200 </tr>
201 <tr>
202 <td width="40%" align="left" valign="top">DB_SEQUENCE-&gt;close() </td>
203 <td width="20%" align="center">
204 <a accesskey="h" href="index.html">Home</a>
205 </td>
206 <td width="40%" align="right" valign="top"> DB_SEQUENCE-&gt;get_cachesize()</td>
207 </tr>
208 </table>
209 </div>
210 </body>
211 </html>