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->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 11. The DB_SEQUENCE Handle" /> 11 <link rel="prev" href="seqset_range.html" title="DB_SEQUENCE->set_range()" /> 12 <link rel="next" href="seqstat_print.html" title="DB_SEQUENCE->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">DB_SEQUENCE->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 11. 23 The DB_SEQUENCE 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>DB_SEQUENCE->stat()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB_SEQUENCE->stat(DB_SEQUENCE *db, DB_SEQUENCE_STAT **spp, u_int32_t flags); </pre> 42 <p> 43 The <code class="methodname">DB_SEQUENCE->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="DB_ENV->set_alloc()">DB_ENV->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">DB_SEQUENCE->stat()</code> may be 62 out-of-date. 63 </p> 64 <p> 65 The <code class="methodname">DB_SEQUENCE->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">DB_SEQUENCE->stat()</code> <span> 71 <span> 72 method returns a non-zero error value on failure and 0 on success. 73 </span> 74 75 </span> 76 </p> 77 <p> 78 The statistics are stored in a structure of type <code class="literal">DB_SEQUENCE_STAT</code>. 79 The following fields will be filled in: 80 </p> 81 <div class="itemizedlist"> 82 <ul type="disc"> 83 <li> 84 <p> 85 <span class="bold"><strong>uintmax_t st_wait;</strong></span> 86 </p> 87 <p> 88 The number of times a thread of control was forced to wait on the 89 handle mutex. 90 </p> 91 </li> 92 <li> 93 <p> 94 <span class="bold"><strong>uintmax_t st_nowait;</strong></span> 95 </p> 96 <p> 97 The number of times that a thread of control was able to obtain handle 98 mutex without waiting. 99 </p> 100 </li> 101 <li> 102 <p> 103 <span class="bold"><strong>db_seq_t st_current;</strong></span> 104 </p> 105 <p> 106 The current value of the sequence in the database. 107 </p> 108 </li> 109 <li> 110 <p> 111 <span class="bold"><strong>db_seq_t st_value;</strong></span> 112 </p> 113 <p> 114 The current cached value of the sequence. 115 </p> 116 </li> 117 <li> 118 <p> 119 <span class="bold"><strong>db_seq_t st_last_value;</strong></span> 120 </p> 121 <p> 122 The last cached value of the sequence. 123 </p> 124 </li> 125 <li> 126 <p> 127 <span class="bold"><strong>db_seq_t st_min;</strong></span> 128 </p> 129 <p> 130 The minimum permitted value of the sequence. 131 </p> 132 </li> 133 <li> 134 <p> 135 <span class="bold"><strong>db_seq_t st_max;</strong></span> 136 </p> 137 <p> 138 The maximum permitted value of the sequence. 139 </p> 140 </li> 141 <li> 142 <p> 143 <span class="bold"><strong>int32_t st_cache_size;</strong></span> 144 </p> 145 <p> 146 The number of values that will be cached in this handle. 147 </p> 148 </li> 149 <li> 150 <p> 151 <span class="bold"><strong>u_int32_t st_flags;</strong></span> 152 </p> 153 <p> 154 The flags value for the sequence. 155 </p> 156 </li> 157 </ul> 158 </div> 159 <div class="sect2" lang="en" xml:lang="en"> 160 <div class="titlepage"> 161 <div> 162 <div> 163 <h3 class="title"><a id="id1707002"></a>Parameters</h3> 164 </div> 165 </div> 166 </div> 167 <div class="sect3" lang="en" xml:lang="en"> 168 <div class="titlepage"> 169 <div> 170 <div> 171 <h4 class="title"><a id="id1706754"></a>flags</h4> 172 </div> 173 </div> 174 </div> 175 <p> 176 The <span class="bold"><strong>flags</strong></span> parameter must be set by 177 bitwise inclusively <span class="bold"><strong>OR</strong></span>'ing together 178 one or more of the following values: 179 </p> 180 <div class="itemizedlist"> 181 <ul type="disc"> 182 <li> 183 <p> 184 <code class="literal">DB_STAT_CLEAR</code> 185 </p> 186 <p> 187 Reset statistics after printing their values. 188 </p> 189 </li> 190 </ul> 191 </div> 192 </div> 193 </div> 194 <div class="sect2" lang="en" xml:lang="en"> 195 <div class="titlepage"> 196 <div> 197 <div> 198 <h3 class="title"><a id="id1707096"></a>Class</h3> 199 </div> 200 </div> 201 </div> 202 <p> 203 <a class="link" href="seq.html" title="Chapter 11. The DB_SEQUENCE Handle">DB_SEQUENCE</a> 204 </p> 205 </div> 206 <div class="sect2" lang="en" xml:lang="en"> 207 <div class="titlepage"> 208 <div> 209 <div> 210 <h3 class="title"><a id="id1707006"></a>See Also</h3> 211 </div> 212 </div> 213 </div> 214 <p> 215 <a class="xref" href="seq.html#seqlist" title="Sequences and Related Methods">Sequences and Related Methods</a> 216 </p> 217 </div> 218 </div> 219 <div class="navfooter"> 220 <hr /> 221 <table width="100%" summary="Navigation footer"> 222 <tr> 223 <td width="40%" align="left"><a accesskey="p" href="seqset_range.html">Prev</a> </td> 224 <td width="20%" align="center"> 225 <a accesskey="u" href="seq.html">Up</a> 226 </td> 227 <td width="40%" align="right"> <a accesskey="n" href="seqstat_print.html">Next</a></td> 228 </tr> 229 <tr> 230 <td width="40%" align="left" valign="top">DB_SEQUENCE->set_range() </td> 231 <td width="20%" align="center"> 232 <a accesskey="h" href="index.html">Home</a> 233 </td> 234 <td width="40%" align="right" valign="top"> DB_SEQUENCE->stat_print()</td> 235 </tr> 236 </table> 237 </div> 238 </body> 239</html> 240