| 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->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="db.html" title="Chapter 2. The DB Handle" /> |
| 11 | <link rel="prev" href="dbsort_multiple.html" title="DB->sort_multiple()" /> |
| 12 | <link rel="next" href="dbstat_print.html" title="DB->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->stat()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="dbsort_multiple.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 2. |
| 26 | The DB Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="dbstat_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="dbstat"></a>DB->stat()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DB->stat(DB *db, DB_TXN *txnid, void *sp, u_int32_t flags); </pre> |
| 45 | <p> |
| 46 | The <code class="methodname">DB->stat()</code> method creates a statistical structure and copies a |
| 47 | pointer to it into user-specified memory locations. Specifically, if |
| 48 | <span class="bold"><strong>sp</strong></span> is non-NULL, a pointer to the |
| 49 | statistics for the database are copied into the memory location to |
| 50 | which it refers. |
| 51 | </p> |
| 52 | <p> |
| 53 | The <code class="methodname">DB->stat()</code> <span> |
| 54 | <span> |
| 55 | method returns a non-zero error value on failure and 0 on success. |
| 56 | </span> |
| 57 | |
| 58 | </span> |
| 59 | </p> |
| 60 | <div class="sect2" lang="en" xml:lang="en"> |
| 61 | <div class="titlepage"> |
| 62 | <div> |
| 63 | <div> |
| 64 | <h3 class="title"><a id="idp50606888"></a>Parameters</h3> |
| 65 | </div> |
| 66 | </div> |
| 67 | </div> |
| 68 | <div class="sect3" lang="en" xml:lang="en"> |
| 69 | <div class="titlepage"> |
| 70 | <div> |
| 71 | <div> |
| 72 | <h4 class="title"><a id="idp50607536"></a>txnid</h4> |
| 73 | </div> |
| 74 | </div> |
| 75 | </div> |
| 76 | <p> |
| 77 | If the operation is part of an application-specified transaction, the |
| 78 | <span class="bold"><strong>txnid</strong></span> parameter is a transaction |
| 79 | handle returned from <a class="xref" href="txnbegin.html" title="DB_ENV->txn_begin()">DB_ENV->txn_begin()</a>; if the |
| 80 | operation is part of a Berkeley DB Concurrent Data Store group, the |
| 81 | <span class="bold"><strong>txnid</strong></span> parameter is a handle returned |
| 82 | from <a class="xref" href="envcdsgroup_begin.html" title="DB_ENV->cdsgroup_begin()">DB_ENV->cdsgroup_begin()</a>; |
| 83 | otherwise NULL. If no transaction handle is specified, but the |
| 84 | operation occurs in a transactional database, the operation will be |
| 85 | implicitly transaction protected. |
| 86 | </p> |
| 87 | </div> |
| 88 | <div class="sect3" lang="en" xml:lang="en"> |
| 89 | <div class="titlepage"> |
| 90 | <div> |
| 91 | <div> |
| 92 | <h4 class="title"><a id="idp50622872"></a>flags</h4> |
| 93 | </div> |
| 94 | </div> |
| 95 | </div> |
| 96 | <p> |
| 97 | The <span class="bold"><strong>flags</strong></span> parameter must be set to 0 |
| 98 | or one of the following values: |
| 99 | </p> |
| 100 | <div class="itemizedlist"> |
| 101 | <ul type="disc"> |
| 102 | <li> |
| 103 | <p><a id="stat_DB_FAST_STAT"></a> |
| 104 | <code class="literal">DB_FAST_STAT</code> |
| 105 | </p> |
| 106 | <p> |
| 107 | Return only the values which do not require traversal of the database. |
| 108 | Among other things, this flag makes it possible for applications to |
| 109 | request key and record counts without incurring the performance |
| 110 | penalty of traversing the entire database. |
| 111 | </p> |
| 112 | </li> |
| 113 | <li> |
| 114 | <p><a id="stat_DB_READ_COMMITTED"></a> |
| 115 | <code class="literal">DB_READ_COMMITTED</code> |
| 116 | </p> |
| 117 | <p> |
| 118 | Database items read during a transactional call will have degree 2 |
| 119 | isolation. This ensures the stability of the data items read during |
| 120 | the stat operation but permits that data to be modified or deleted by |
| 121 | other transactions prior to the commit of the specified transaction. |
| 122 | </p> |
| 123 | </li> |
| 124 | <li> |
| 125 | <p><a id="stat_DB_READ_UNCOMMITTED"></a> |
| 126 | <code class="literal">DB_READ_UNCOMMITTED</code> |
| 127 | </p> |
| 128 | <p> |
| 129 | Database items read during a transactional call will have degree 1 |
| 130 | isolation, including modified but not yet committed data. Silently |
| 131 | ignored if the |
| 132 | <a class="link" href="dbopen.html#dbopen_DB_READ_UNCOMMITTED">DB_READ_UNCOMMITTED</a> |
| 133 | flag was not specified when the underlying database was opened. |
| 134 | </p> |
| 135 | </li> |
| 136 | </ul> |
| 137 | </div> |
| 138 | </div> |
| 139 | </div> |
| 140 | <div class="sect2" lang="en" xml:lang="en"> |
| 141 | <div class="titlepage"> |
| 142 | <div> |
| 143 | <div> |
| 144 | <h3 class="title"><a id="idp50629792"></a>Statistical Structure</h3> |
| 145 | </div> |
| 146 | </div> |
| 147 | </div> |
| 148 | <p> |
| 149 | Statistical structures are stored in allocated memory. If |
| 150 | application-specific allocation routines have been declared (see |
| 151 | <a class="xref" href="envset_alloc.html" title="DB_ENV->set_alloc()">DB_ENV->set_alloc()</a> |
| 152 | for more information), they are used to allocate the |
| 153 | memory; otherwise, the standard C library |
| 154 | <span class="bold"><strong>malloc</strong></span>(3) is used. The caller is |
| 155 | responsible for deallocating the memory. To deallocate the memory, free the |
| 156 | memory reference; references inside the returned memory need not be |
| 157 | individually freed. |
| 158 | </p> |
| 159 | <p> |
| 160 | If the DB_FAST_STAT flag has not been specified, the |
| 161 | <code class="methodname">DB->stat()</code> method will |
| 162 | access some of or all the pages in the database, incurring a severe |
| 163 | performance penalty as well as possibly flushing the underlying buffer pool. |
| 164 | </p> |
| 165 | <p> |
| 166 | In the presence of multiple threads or processes accessing an active |
| 167 | database, the information returned by DB->stat may be out-of-date. |
| 168 | </p> |
| 169 | <p> |
| 170 | If the database was not opened read-only and the DB_FAST_STAT flag was not |
| 171 | specified, the cached key and record numbers will be updated after the |
| 172 | statistical information has been gathered. |
| 173 | </p> |
| 174 | <p> |
| 175 | The <code class="methodname">DB->stat()</code> method may not be called before the |
| 176 | <a class="xref" href="dbopen.html" title="DB->open()">DB->open()</a> |
| 177 | method is called. |
| 178 | </p> |
| 179 | <p> |
| 180 | The <code class="methodname">DB->stat()</code> method returns |
| 181 | a non-zero error value on failure and 0 on success. |
| 182 | </p> |
| 183 | <div class="sect3" lang="en" xml:lang="en"> |
| 184 | <div class="titlepage"> |
| 185 | <div> |
| 186 | <div> |
| 187 | <h4 class="title"><a id="idp50631872"></a>Hash Statistics</h4> |
| 188 | </div> |
| 189 | </div> |
| 190 | </div> |
| 191 | <p> |
| 192 | In the case of a Hash database, the statistics are stored in a |
| 193 | structure of type <code class="literal">DB_HASH_STAT</code>. The following fields will be filled |
| 194 | in: |
| 195 | </p> |
| 196 | <div class="itemizedlist"> |
| 197 | <ul type="disc"> |
| 198 | <li> |
| 199 | <p> |
| 200 | <code class="literal">uintmax_t hash_bfree;</code> |
| 201 | </p> |
| 202 | <p> |
| 203 | The number of bytes free on bucket pages. |
| 204 | </p> |
| 205 | </li> |
| 206 | <li> |
| 207 | <p> |
| 208 | <code class="literal">u_int32_t hash_bigpages;</code> |
| 209 | </p> |
| 210 | <p> |
| 211 | The number of big key/data pages. |
| 212 | </p> |
| 213 | </li> |
| 214 | <li> |
| 215 | <p> |
| 216 | <code class="literal">uintmax_t hash_big_bfree;</code> |
| 217 | </p> |
| 218 | <p> |
| 219 | The number of bytes free on big item pages. |
| 220 | </p> |
| 221 | </li> |
| 222 | <li> |
| 223 | <p> |
| 224 | <code class="literal">u_int32_t hash_buckets;</code> |
| 225 | </p> |
| 226 | <p> |
| 227 | The number of hash buckets. Returned if DB_FAST_STAT is set. |
| 228 | </p> |
| 229 | </li> |
| 230 | <li> |
| 231 | <p> |
| 232 | <code class="literal">u_int32_t hash_dup;</code> |
| 233 | </p> |
| 234 | <p> |
| 235 | The number of duplicate pages. |
| 236 | </p> |
| 237 | </li> |
| 238 | <li> |
| 239 | <p> |
| 240 | <code class="literal">uintmax_t hash_dup_free;</code> |
| 241 | </p> |
| 242 | <p> |
| 243 | The number of bytes free on duplicate pages. |
| 244 | </p> |
| 245 | </li> |
| 246 | <li> |
| 247 | <p> |
| 248 | <code class="literal">u_int32_t hash_ffactor;</code> |
| 249 | </p> |
| 250 | <p> |
| 251 | The desired fill factor (number of items per bucket) specified at |
| 252 | database-creation time. Returned if DB_FAST_STAT is set. |
| 253 | </p> |
| 254 | </li> |
| 255 | <li> |
| 256 | <p> |
| 257 | <code class="literal">u_int32_t hash_free;</code> |
| 258 | </p> |
| 259 | <p> |
| 260 | The number of pages on the free list. |
| 261 | </p> |
| 262 | </li> |
| 263 | <li> |
| 264 | <p> |
| 265 | <code class="literal">u_int32_t hash_magic;</code> |
| 266 | </p> |
| 267 | <p> |
| 268 | Magic number that identifies the file as a Hash file. Returned if |
| 269 | DB_FAST_STAT is set. |
| 270 | </p> |
| 271 | </li> |
| 272 | <li> |
| 273 | <p> |
| 274 | <code class="literal">u_int32_t hash_metaflags;</code> |
| 275 | </p> |
| 276 | <p> |
| 277 | Reports internal flags. For internal use |
| 278 | only. |
| 279 | </p> |
| 280 | </li> |
| 281 | <li> |
| 282 | <p> |
| 283 | <code class="literal">u_int32_t hash_ndata;</code> |
| 284 | </p> |
| 285 | <p> |
| 286 | The number of key/data pairs in the database. If DB_FAST_STAT was |
| 287 | specified the count will be the last saved value unless it has never |
| 288 | been calculated, in which case it will be 0. Returned if DB_FAST_STAT |
| 289 | is set. |
| 290 | </p> |
| 291 | </li> |
| 292 | <li> |
| 293 | <p> |
| 294 | <code class="literal">u_int32_t hash_nkeys;</code> |
| 295 | </p> |
| 296 | <p> |
| 297 | The number of unique keys in the database. If DB_FAST_STAT was |
| 298 | specified the count will be the last saved value unless it has never |
| 299 | been calculated, in which case it will be 0. Returned if DB_FAST_STAT |
| 300 | is set. |
| 301 | </p> |
| 302 | </li> |
| 303 | <li> |
| 304 | <p> |
| 305 | <code class="literal">u_int32_t hash_overflows;</code> |
| 306 | </p> |
| 307 | <p> |
| 308 | The number of overflow pages (overflow pages are pages that contain |
| 309 | items that did not fit in the main bucket page). |
| 310 | </p> |
| 311 | </li> |
| 312 | <li> |
| 313 | <p> |
| 314 | <code class="literal">uintmax_t hash_ovfl_free;</code> |
| 315 | </p> |
| 316 | <p> |
| 317 | The number of bytes free on overflow pages. |
| 318 | </p> |
| 319 | </li> |
| 320 | <li> |
| 321 | <p> |
| 322 | <code class="literal">u_int32_t hash_pagecnt;</code> |
| 323 | </p> |
| 324 | <p> |
| 325 | The number of pages in the database. Returned if DB_FAST_STAT is set. |
| 326 | </p> |
| 327 | </li> |
| 328 | <li> |
| 329 | <p> |
| 330 | <code class="literal">u_int32_t hash_pagesize;</code> |
| 331 | </p> |
| 332 | <p> |
| 333 | The underlying database page (and bucket) size, in bytes. Returned if |
| 334 | DB_FAST_STAT is set. |
| 335 | </p> |
| 336 | </li> |
| 337 | <li> |
| 338 | <p> |
| 339 | <code class="literal">u_int32_t hash_version;</code> |
| 340 | </p> |
| 341 | <p> |
| 342 | The version of the Hash database. Returned if DB_FAST_STAT is set. |
| 343 | </p> |
| 344 | </li> |
| 345 | </ul> |
| 346 | </div> |
| 347 | </div> |
| 348 | <div class="sect3" lang="en" xml:lang="en"> |
| 349 | <div class="titlepage"> |
| 350 | <div> |
| 351 | <div> |
| 352 | <h4 class="title"><a id="idp50607704"></a>Heap Statistics</h4> |
| 353 | </div> |
| 354 | </div> |
| 355 | </div> |
| 356 | <p> |
| 357 | In the case of a Heap database, the statistics are stored in a |
| 358 | structure of type <code class="literal">DB_HEAP_STAT</code>. The following fields will be filled |
| 359 | in: |
| 360 | </p> |
| 361 | <div class="itemizedlist"> |
| 362 | <ul type="disc"> |
| 363 | <li> |
| 364 | <p> |
| 365 | <code class="literal">u_int32_t heap_magic;</code> |
| 366 | </p> |
| 367 | <p> |
| 368 | Magic number that identifies the file as a Heap file. Returned if |
| 369 | DB_FAST_STAT is set. |
| 370 | </p> |
| 371 | </li> |
| 372 | <li> |
| 373 | <p> |
| 374 | <code class="literal">u_int32_t heap_version;</code> |
| 375 | </p> |
| 376 | <p> |
| 377 | The version of the Heap database. Returned if DB_FAST_STAT is set. |
| 378 | </p> |
| 379 | </li> |
| 380 | <li> |
| 381 | <p> |
| 382 | <code class="literal">u_int32_t heap_metaflags;</code> |
| 383 | </p> |
| 384 | <p> |
| 385 | Reports internal flags. For internal use |
| 386 | only. |
| 387 | </p> |
| 388 | </li> |
| 389 | <li> |
| 390 | <p> |
| 391 | <code class="literal">u_int32_t heap_nrecs;</code> |
| 392 | </p> |
| 393 | <p> |
| 394 | Reports the number of records in the Heap |
| 395 | database. Returned if DB_FAST_STAT is set. |
| 396 | </p> |
| 397 | </li> |
| 398 | <li> |
| 399 | <p> |
| 400 | <code class="literal">u_int32_t heap_pagecnt;</code> |
| 401 | </p> |
| 402 | <p> |
| 403 | The number of pages in the database. Returned if DB_FAST_STAT is set. |
| 404 | </p> |
| 405 | </li> |
| 406 | <li> |
| 407 | <p> |
| 408 | <code class="literal">u_int32_t heap_pagesize;</code> |
| 409 | </p> |
| 410 | <p> |
| 411 | The underlying database page (and bucket) size, in bytes. Returned if |
| 412 | DB_FAST_STAT is set. |
| 413 | </p> |
| 414 | </li> |
| 415 | <li> |
| 416 | <p> |
| 417 | <code class="literal">u_int32_t heap_nregions;</code> |
| 418 | </p> |
| 419 | <p> |
| 420 | The number of regions in the Heap database. Returned if |
| 421 | DB_FAST_STAT is set. |
| 422 | </p> |
| 423 | </li> |
| 424 | <li> |
| 425 | <p> |
| 426 | <code class="literal">u_int32_t heap_regionsize;</code> |
| 427 | </p> |
| 428 | <p> |
| 429 | The number of pages in a region in the Heap database. Returned if |
| 430 | DB_FAST_STAT is set. |
| 431 | </p> |
| 432 | </li> |
| 433 | </ul> |
| 434 | </div> |
| 435 | </div> |
| 436 | <div class="sect3" lang="en" xml:lang="en"> |
| 437 | <div class="titlepage"> |
| 438 | <div> |
| 439 | <div> |
| 440 | <h4 class="title"><a id="idp50647248"></a>Btree and Recno Statistics</h4> |
| 441 | </div> |
| 442 | </div> |
| 443 | </div> |
| 444 | <p> |
| 445 | In the case of a Btree or Recno database, the |
| 446 | statistics are stored in a structure of type |
| 447 | <code class="literal">DB_BTREE_STAT</code>. The following fields |
| 448 | will be filled in: |
| 449 | </p> |
| 450 | <div class="itemizedlist"> |
| 451 | <ul type="disc"> |
| 452 | <li> |
| 453 | <p> |
| 454 | <code class="literal">u_int32_t bt_dup_pg;</code> |
| 455 | </p> |
| 456 | <p> |
| 457 | Number of database duplicate pages. |
| 458 | </p> |
| 459 | </li> |
| 460 | <li> |
| 461 | <p> |
| 462 | <code class="literal">uintmax_t bt_dup_pgfree;</code> |
| 463 | </p> |
| 464 | <p> |
| 465 | Number of bytes free in database duplicate pages. |
| 466 | </p> |
| 467 | </li> |
| 468 | <li> |
| 469 | <p> |
| 470 | <code class="literal">u_int32_t bt_empty_pg;</code> |
| 471 | </p> |
| 472 | <p> |
| 473 | Number of empty database pages. |
| 474 | </p> |
| 475 | </li> |
| 476 | <li> |
| 477 | <p> |
| 478 | <code class="literal">u_int32_t bt_free;</code> |
| 479 | </p> |
| 480 | <p> |
| 481 | Number of pages on the free list. |
| 482 | </p> |
| 483 | </li> |
| 484 | <li> |
| 485 | <p> |
| 486 | <code class="literal">u_int32_t bt_int_pg;</code> |
| 487 | </p> |
| 488 | <p> |
| 489 | Number of database internal pages. |
| 490 | </p> |
| 491 | </li> |
| 492 | <li> |
| 493 | <p> |
| 494 | <code class="literal">uintmax_t bt_int_pgfree;</code> |
| 495 | </p> |
| 496 | <p> |
| 497 | Number of bytes free in database internal pages. |
| 498 | </p> |
| 499 | </li> |
| 500 | <li> |
| 501 | <p> |
| 502 | <code class="literal">u_int32_t bt_leaf_pg;</code> |
| 503 | </p> |
| 504 | <p> |
| 505 | Number of database leaf pages. |
| 506 | </p> |
| 507 | </li> |
| 508 | <li> |
| 509 | <p> |
| 510 | <code class="literal">uintmax_t bt_leaf_pgfree;</code> |
| 511 | </p> |
| 512 | <p> |
| 513 | Number of bytes free in database leaf pages. |
| 514 | </p> |
| 515 | </li> |
| 516 | <li> |
| 517 | <p> |
| 518 | <code class="literal">u_int32_t bt_levels;</code> |
| 519 | </p> |
| 520 | <p> |
| 521 | Number of levels in the database. |
| 522 | </p> |
| 523 | </li> |
| 524 | <li> |
| 525 | <p> |
| 526 | <code class="literal">u_int32_t bt_magic;</code> |
| 527 | </p> |
| 528 | <p> |
| 529 | Magic number that identifies the file as a Btree database. Returned |
| 530 | if DB_FAST_STAT is set. |
| 531 | </p> |
| 532 | </li> |
| 533 | <li> |
| 534 | <p> |
| 535 | <code class="literal">u_int32_t bt_metaflags;</code> |
| 536 | </p> |
| 537 | <p> |
| 538 | Reports internal flags. For internal use |
| 539 | only. |
| 540 | </p> |
| 541 | </li> |
| 542 | <li> |
| 543 | <p> |
| 544 | <code class="literal">u_int32_t bt_minkey;</code> |
| 545 | </p> |
| 546 | <p> |
| 547 | The minimum keys per page. Returned if DB_FAST_STAT is set. |
| 548 | </p> |
| 549 | </li> |
| 550 | <li> |
| 551 | <p> |
| 552 | <code class="literal">u_int32_t bt_ndata;</code> |
| 553 | </p> |
| 554 | <p> |
| 555 | For the Btree Access Method, the number of key/data pairs in the |
| 556 | database. If the DB_FAST_STAT flag is not specified, the count will |
| 557 | be exact. Otherwise, the count will be the last saved value unless it |
| 558 | has never been calculated, in which case it will be 0. |
| 559 | </p> |
| 560 | <p> |
| 561 | For the Recno Access Method, the number of records in the database. |
| 562 | If the database was configured with mutable record numbers (see |
| 563 | <a class="link" href="dbset_flags.html#dbset_flags_DB_RENUMBER">DB_RENUMBER</a>), |
| 564 | the count will be exact. Otherwise, if the DB_FAST_STAT flag is specified |
| 565 | the count will be exact but will include deleted and implicitly |
| 566 | created records; if the DB_FAST_STAT flag is not specified, the count |
| 567 | will be exact and will not include deleted or implicitly created |
| 568 | records. |
| 569 | </p> |
| 570 | <p> |
| 571 | Returned if DB_FAST_STAT is set. |
| 572 | </p> |
| 573 | </li> |
| 574 | <li> |
| 575 | <p> |
| 576 | <code class="literal">u_int32_t bt_nkeys;</code> |
| 577 | </p> |
| 578 | <p> |
| 579 | For the Btree Access Method, the number of keys in the database. If |
| 580 | the DB_FAST_STAT flag is not specified or the database was configured |
| 581 | to support record numbers (see |
| 582 | <a class="link" href="dbset_flags.html#dbset_flags_DB_RECNUM">DB_RECNUM</a>), |
| 583 | the count will be exact. Otherwise, the count will be the last saved |
| 584 | value unless it has never been calculated, in which case it will be 0. |
| 585 | </p> |
| 586 | <p> |
| 587 | For the Recno Access Method, the number of records in the database. |
| 588 | If the database was configured with mutable record numbers (see |
| 589 | <a class="link" href="dbset_flags.html#dbset_flags_DB_RENUMBER">DB_RENUMBER</a>), |
| 590 | the count will be exact. Otherwise, if the DB_FAST_STAT flag is specified |
| 591 | the count will be exact but will include deleted and implicitly |
| 592 | created records; if the DB_FAST_STAT flag is not specified, the count |
| 593 | will be exact and will not include deleted or implicitly created |
| 594 | records. |
| 595 | </p> |
| 596 | <p> |
| 597 | Returned if DB_FAST_STAT is set. |
| 598 | </p> |
| 599 | </li> |
| 600 | <li> |
| 601 | <p> |
| 602 | <code class="literal">u_int32_t bt_over_pg;</code> |
| 603 | </p> |
| 604 | <p> |
| 605 | Number of database overflow pages. |
| 606 | </p> |
| 607 | </li> |
| 608 | <li> |
| 609 | <p> |
| 610 | <code class="literal">uintmax_t bt_over_pgfree;</code> |
| 611 | </p> |
| 612 | <p> |
| 613 | Number of bytes free in database overflow pages. |
| 614 | </p> |
| 615 | </li> |
| 616 | <li> |
| 617 | <p> |
| 618 | <code class="literal">u_int32_t bt_pagecnt;</code> |
| 619 | </p> |
| 620 | <p> |
| 621 | The number of pages in the database. Returned if DB_FAST_STAT is set. |
| 622 | </p> |
| 623 | </li> |
| 624 | <li> |
| 625 | <p> |
| 626 | <code class="literal">u_int32_t bt_pagesize;</code> |
| 627 | </p> |
| 628 | <p> |
| 629 | The underlying database page size, in bytes. Returned if DB_FAST_STAT |
| 630 | is set. |
| 631 | </p> |
| 632 | </li> |
| 633 | <li> |
| 634 | <p> |
| 635 | <code class="literal">u_int32_t bt_re_len;</code> |
| 636 | </p> |
| 637 | <p> |
| 638 | The length of fixed-length records. Returned if DB_FAST_STAT is set. |
| 639 | </p> |
| 640 | </li> |
| 641 | <li> |
| 642 | <p> |
| 643 | <code class="literal">u_int32_t bt_re_pad;</code> |
| 644 | </p> |
| 645 | <p> |
| 646 | The padding byte value for fixed-length records. Returned if |
| 647 | DB_FAST_STAT is set. |
| 648 | </p> |
| 649 | </li> |
| 650 | <li> |
| 651 | <p> |
| 652 | <code class="literal">u_int32_t bt_version;</code> |
| 653 | </p> |
| 654 | <p> |
| 655 | The version of the Btree database. Returned if DB_FAST_STAT is set. |
| 656 | </p> |
| 657 | </li> |
| 658 | </ul> |
| 659 | </div> |
| 660 | </div> |
| 661 | <div class="sect3" lang="en" xml:lang="en"> |
| 662 | <div class="titlepage"> |
| 663 | <div> |
| 664 | <div> |
| 665 | <h4 class="title"><a id="idp50680688"></a>Queue Statistics</h4> |
| 666 | </div> |
| 667 | </div> |
| 668 | </div> |
| 669 | <p> |
| 670 | In the case of a Queue database, the statistics are |
| 671 | stored in a structure of type |
| 672 | <code class="literal">DB_QUEUE_STAT</code>. The following fields |
| 673 | will be filled in: |
| 674 | </p> |
| 675 | <div class="itemizedlist"> |
| 676 | <ul type="disc"> |
| 677 | <li> |
| 678 | <p> |
| 679 | <code class="literal">u_int32_t qs_cur_recno;</code> |
| 680 | </p> |
| 681 | <p> |
| 682 | Next available record number. Returned if DB_FAST_STAT is set. |
| 683 | </p> |
| 684 | </li> |
| 685 | <li> |
| 686 | <p> |
| 687 | <code class="literal">u_int32_t qs_extentsize;</code> |
| 688 | </p> |
| 689 | <p> |
| 690 | Underlying database extent size, in pages. Returned if DB_FAST_STAT |
| 691 | is set. |
| 692 | </p> |
| 693 | </li> |
| 694 | <li> |
| 695 | <p> |
| 696 | <code class="literal">u_int32_t qs_first_recno;</code> |
| 697 | </p> |
| 698 | <p> |
| 699 | First undeleted record in the database. Returned if DB_FAST_STAT is |
| 700 | set. |
| 701 | </p> |
| 702 | </li> |
| 703 | <li> |
| 704 | <p> |
| 705 | <code class="literal">u_int32_t qs_magic;</code> |
| 706 | </p> |
| 707 | <p> |
| 708 | Magic number that identifies the file as a Queue file. Returned if |
| 709 | DB_FAST_STAT is set. |
| 710 | </p> |
| 711 | </li> |
| 712 | <li> |
| 713 | <p> |
| 714 | <code class="literal">u_int32_t qs_metaflags;</code> |
| 715 | </p> |
| 716 | <p> |
| 717 | Reports internal flags. For internal use |
| 718 | only. |
| 719 | </p> |
| 720 | </li> |
| 721 | <li> |
| 722 | <p> |
| 723 | <code class="literal">u_int32_t qs_nkeys;</code> |
| 724 | </p> |
| 725 | <p> |
| 726 | The number of records in the database. If DB_FAST_STAT was specified |
| 727 | the count will be the last saved value unless it has never been |
| 728 | calculated, in which case it will be 0. Returned if DB_FAST_STAT is |
| 729 | set. |
| 730 | </p> |
| 731 | </li> |
| 732 | <li> |
| 733 | <p> |
| 734 | <code class="literal">u_int32_t qs_ndata;</code> |
| 735 | </p> |
| 736 | <p> |
| 737 | The number of records in the database. If DB_FAST_STAT was specified |
| 738 | the count will be the last saved value unless it has never been |
| 739 | calculated, in which case it will be 0. Returned if DB_FAST_STAT is |
| 740 | set. |
| 741 | </p> |
| 742 | </li> |
| 743 | <li> |
| 744 | <p> |
| 745 | <code class="literal">u_int32_t qs_pages;</code> |
| 746 | </p> |
| 747 | <p> |
| 748 | Number of pages in the database. |
| 749 | </p> |
| 750 | </li> |
| 751 | <li> |
| 752 | <p> |
| 753 | <code class="literal">u_int32_t qs_pagesize;</code> |
| 754 | </p> |
| 755 | <p> |
| 756 | Underlying database page size, in bytes. Returned if DB_FAST_STAT is |
| 757 | set. |
| 758 | </p> |
| 759 | </li> |
| 760 | <li> |
| 761 | <p> |
| 762 | <code class="literal">u_int32_t qs_pgfree;</code> |
| 763 | </p> |
| 764 | <p> |
| 765 | Number of bytes free in database pages. |
| 766 | </p> |
| 767 | </li> |
| 768 | <li> |
| 769 | <p> |
| 770 | <code class="literal">u_int32_t qs_re_len;</code> |
| 771 | </p> |
| 772 | <p> |
| 773 | The length of the records. Returned if DB_FAST_STAT is set. |
| 774 | </p> |
| 775 | </li> |
| 776 | <li> |
| 777 | <p> |
| 778 | <code class="literal">u_int32_t qs_re_pad;</code> |
| 779 | </p> |
| 780 | <p> |
| 781 | The padding byte value for the records. Returned if DB_FAST_STAT is |
| 782 | set. |
| 783 | </p> |
| 784 | </li> |
| 785 | <li> |
| 786 | <p> |
| 787 | <code class="literal">u_int32_t qs_version;</code> |
| 788 | </p> |
| 789 | <p> |
| 790 | The version of the Queue file type. Returned if DB_FAST_STAT is set. |
| 791 | </p> |
| 792 | </li> |
| 793 | </ul> |
| 794 | </div> |
| 795 | </div> |
| 796 | </div> |
| 797 | <div class="sect2" lang="en" xml:lang="en"> |
| 798 | <div class="titlepage"> |
| 799 | <div> |
| 800 | <div> |
| 801 | <h3 class="title"><a id="idp50657600"></a>Errors</h3> |
| 802 | </div> |
| 803 | </div> |
| 804 | </div> |
| 805 | <p> |
| 806 | The <code class="methodname">DB->stat()</code> <span> |
| 807 | <span> |
| 808 | method may fail and return one of the following non-zero errors: |
| 809 | </span> |
| 810 | |
| 811 | </span> |
| 812 | </p> |
| 813 | <div class="sect3" lang="en" xml:lang="en"> |
| 814 | <div class="titlepage"> |
| 815 | <div> |
| 816 | <div> |
| 817 | <h4 class="title"><a id="idp50650224"></a> DB_REP_HANDLE_DEAD</h4> |
| 818 | </div> |
| 819 | </div> |
| 820 | </div> |
| 821 | <p> |
| 822 | When a client synchronizes with the master, it is possible for committed |
| 823 | transactions to be rolled back. This invalidates all the database and cursor |
| 824 | handles opened in the replication environment. Once this occurs, an attempt to use |
| 825 | such a handle will |
| 826 | |
| 827 | return <code class="literal">DB_REP_HANDLE_DEAD</code>. |
| 828 | The application will need to discard the handle and open a new one in order to |
| 829 | continue processing. |
| 830 | </p> |
| 831 | </div> |
| 832 | <div class="sect3" lang="en" xml:lang="en"> |
| 833 | <div class="titlepage"> |
| 834 | <div> |
| 835 | <div> |
| 836 | <h4 class="title"><a id="idp50694776"></a>DB_REP_LOCKOUT</h4> |
| 837 | </div> |
| 838 | </div> |
| 839 | </div> |
| 840 | <p> |
| 841 | The operation was blocked by client/master synchronization. |
| 842 | </p> |
| 843 | </div> |
| 844 | <div class="sect3" lang="en" xml:lang="en"> |
| 845 | <div class="titlepage"> |
| 846 | <div> |
| 847 | <div> |
| 848 | <h4 class="title"><a id="idp50688264"></a>EINVAL</h4> |
| 849 | </div> |
| 850 | </div> |
| 851 | </div> |
| 852 | <p> |
| 853 | An invalid flag value or parameter was specified. |
| 854 | </p> |
| 855 | </div> |
| 856 | </div> |
| 857 | <div class="sect2" lang="en" xml:lang="en"> |
| 858 | <div class="titlepage"> |
| 859 | <div> |
| 860 | <div> |
| 861 | <h3 class="title"><a id="idp50656176"></a>Class</h3> |
| 862 | </div> |
| 863 | </div> |
| 864 | </div> |
| 865 | <p> |
| 866 | <a class="link" href="db.html" title="Chapter 2. The DB Handle">DB</a> |
| 867 | </p> |
| 868 | </div> |
| 869 | <div class="sect2" lang="en" xml:lang="en"> |
| 870 | <div class="titlepage"> |
| 871 | <div> |
| 872 | <div> |
| 873 | <h3 class="title"><a id="idp50698528"></a>See Also</h3> |
| 874 | </div> |
| 875 | </div> |
| 876 | </div> |
| 877 | <p> |
| 878 | <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a> |
| 879 | </p> |
| 880 | </div> |
| 881 | </div> |
| 882 | <div class="navfooter"> |
| 883 | <hr /> |
| 884 | <table width="100%" summary="Navigation footer"> |
| 885 | <tr> |
| 886 | <td width="40%" align="left"><a accesskey="p" href="dbsort_multiple.html">Prev</a> </td> |
| 887 | <td width="20%" align="center"> |
| 888 | <a accesskey="u" href="db.html">Up</a> |
| 889 | </td> |
| 890 | <td width="40%" align="right"> <a accesskey="n" href="dbstat_print.html">Next</a></td> |
| 891 | </tr> |
| 892 | <tr> |
| 893 | <td width="40%" align="left" valign="top">DB->sort_multiple() </td> |
| 894 | <td width="20%" align="center"> |
| 895 | <a accesskey="h" href="index.html">Home</a> |
| 896 | </td> |
| 897 | <td width="40%" align="right" valign="top"> DB->stat_print()</td> |
| 898 | </tr> |
| 899 | </table> |
| 900 | </div> |
| 901 | </body> |
| 902 | </html> |