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