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::stat()</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="seqset_range.html" title="DbSequence::set_range()" /> 12 <link rel="next" href="seqstat_print.html" title="DbSequence::stat_print()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbSequence::stat()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="seqset_range.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="seqstat_print.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="seqstat"></a>DbSequence::stat()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbSequence::stat(DB_SEQUENCE_STAT **spp, u_int32_t flags); </pre> 42 <p> 43 The <code class="methodname">DbSequence::stat()</code> method creates a statistical structure and 44 copies a pointer to it into user-specified memory locations. 45 Specifically, if <span class="bold"><strong>spp</strong></span> is non-NULL, a 46 pointer to the statistics for the database are copied into the memory 47 location to which it refers. 48 </p> 49 <p> 50 Statistical structures are stored in allocated memory. If 51 application-specific allocation routines have been declared (see 52 <a class="xref" href="envset_alloc.html" title="DbEnv::set_alloc()">DbEnv::set_alloc()</a> 53 for more information), they are used to allocate the memory; 54 otherwise, the standard C library <span class="bold"><strong>malloc</strong></span>(3) is used. The caller is responsible 55 for deallocating the memory. To deallocate the memory, free the 56 memory reference; references inside the returned memory need not be 57 individually freed. 58 </p> 59 <p> 60 In the presence of multiple threads or processes accessing an active 61 sequence, the information returned by <code class="methodname">DbSequence::stat()</code> may be 62 out-of-date. 63 </p> 64 <p> 65 The <code class="methodname">DbSequence::stat()</code> method cannot be transaction-protected. For 66 this reason, it should be called in a thread of control that has no 67 open cursors or active transactions. 68 </p> 69 <p> 70 The <code class="methodname">DbSequence::stat()</code> <span> 71 72 <span> 73 method either returns a non-zero error value or throws an 74 exception that encapsulates a non-zero error value on 75 failure, and returns 0 on success. 76 </span> 77 </span> 78 </p> 79 <p> 80 The statistics are stored in a structure of type <code class="literal">DB_SEQUENCE_STAT</code>. 81 The following fields will be filled in: 82 </p> 83 <div class="itemizedlist"> 84 <ul type="disc"> 85 <li> 86 <p> 87 <span class="bold"><strong>uintmax_t st_wait;</strong></span> 88 </p> 89 <p> 90 The number of times a thread of control was forced to wait on the 91 handle mutex. 92 </p> 93 </li> 94 <li> 95 <p> 96 <span class="bold"><strong>uintmax_t st_nowait;</strong></span> 97 </p> 98 <p> 99 The number of times that a thread of control was able to obtain handle 100 mutex without waiting. 101 </p> 102 </li> 103 <li> 104 <p> 105 <span class="bold"><strong>db_seq_t st_current;</strong></span> 106 </p> 107 <p> 108 The current value of the sequence in the database. 109 </p> 110 </li> 111 <li> 112 <p> 113 <span class="bold"><strong>db_seq_t st_value;</strong></span> 114 </p> 115 <p> 116 The current cached value of the sequence. 117 </p> 118 </li> 119 <li> 120 <p> 121 <span class="bold"><strong>db_seq_t st_last_value;</strong></span> 122 </p> 123 <p> 124 The last cached value of the sequence. 125 </p> 126 </li> 127 <li> 128 <p> 129 <span class="bold"><strong>db_seq_t st_min;</strong></span> 130 </p> 131 <p> 132 The minimum permitted value of the sequence. 133 </p> 134 </li> 135 <li> 136 <p> 137 <span class="bold"><strong>db_seq_t st_max;</strong></span> 138 </p> 139 <p> 140 The maximum permitted value of the sequence. 141 </p> 142 </li> 143 <li> 144 <p> 145 <span class="bold"><strong>int32_t st_cache_size;</strong></span> 146 </p> 147 <p> 148 The number of values that will be cached in this handle. 149 </p> 150 </li> 151 <li> 152 <p> 153 <span class="bold"><strong>u_int32_t st_flags;</strong></span> 154 </p> 155 <p> 156 The flags value for the sequence. 157 </p> 158 </li> 159 </ul> 160 </div> 161 <div class="sect2" lang="en" xml:lang="en"> 162 <div class="titlepage"> 163 <div> 164 <div> 165 <h3 class="title"><a id="id1711392"></a>Parameters</h3> 166 </div> 167 </div> 168 </div> 169 <div class="sect3" lang="en" xml:lang="en"> 170 <div class="titlepage"> 171 <div> 172 <div> 173 <h4 class="title"><a id="id1711680"></a>flags</h4> 174 </div> 175 </div> 176 </div> 177 <p> 178 The <span class="bold"><strong>flags</strong></span> parameter must be set by 179 bitwise inclusively <span class="bold"><strong>OR</strong></span>'ing together 180 one or more of the following values: 181 </p> 182 <div class="itemizedlist"> 183 <ul type="disc"> 184 <li> 185 <p> 186 <code class="literal">DB_STAT_CLEAR</code> 187 </p> 188 <p> 189 Reset statistics after printing their values. 190 </p> 191 </li> 192 </ul> 193 </div> 194 </div> 195 </div> 196 <div class="sect2" lang="en" xml:lang="en"> 197 <div class="titlepage"> 198 <div> 199 <div> 200 <h3 class="title"><a id="id1711583"></a>Class</h3> 201 </div> 202 </div> 203 </div> 204 <p> 205 <a class="link" href="seq.html" title="Chapter��12.�� The DbSequence Handle">DbSequence</a> 206 </p> 207 </div> 208 <div class="sect2" lang="en" xml:lang="en"> 209 <div class="titlepage"> 210 <div> 211 <div> 212 <h3 class="title"><a id="id1711580"></a>See Also</h3> 213 </div> 214 </div> 215 </div> 216 <p> 217 <a class="xref" href="seq.html#seqlist" title="Sequences and Related Methods">Sequences and Related Methods</a> 218 </p> 219 </div> 220 </div> 221 <div class="navfooter"> 222 <hr /> 223 <table width="100%" summary="Navigation footer"> 224 <tr> 225 <td width="40%" align="left"><a accesskey="p" href="seqset_range.html">Prev</a>��</td> 226 <td width="20%" align="center"> 227 <a accesskey="u" href="seq.html">Up</a> 228 </td> 229 <td width="40%" align="right">��<a accesskey="n" href="seqstat_print.html">Next</a></td> 230 </tr> 231 <tr> 232 <td width="40%" align="left" valign="top">DbSequence::set_range()��</td> 233 <td width="20%" align="center"> 234 <a accesskey="h" href="index.html">Home</a> 235 </td> 236 <td width="40%" align="right" valign="top">��DbSequence::stat_print()</td> 237 </tr> 238 </table> 239 </div> 240 </body> 241</html> 242