File: dbstat.html

package info (click to toggle)
db5.3 5.3.28%2Bdfsg1-0.5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 158,360 kB
  • sloc: ansic: 448,411; java: 111,824; tcl: 80,544; sh: 44,326; cs: 33,697; cpp: 21,604; perl: 14,557; xml: 10,799; makefile: 4,077; yacc: 1,003; awk: 965; sql: 801; erlang: 342; python: 216; php: 24; asm: 14
file content (914 lines) | stat: -rw-r--r-- 37,051 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Db::stat()</title>
    <link rel="stylesheet" href="apiReference.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" />
    <link rel="up" href="db.html" title="Chapter 2.  The Db Handle" />
    <link rel="prev" href="dbsort_multiple.html" title="Db::sort_multiple()" />
    <link rel="next" href="dbstat_print.html" title="Db::stat_print()" />
  </head>
  <body>
    <div xmlns="" class="navheader">
      <div class="libver">
        <p>Library Version 11.2.5.3</p>
      </div>
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Db::stat()</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="dbsort_multiple.html">Prev</a> </td>
          <th width="60%" align="center">Chapter 2. 
                The Db Handle
        </th>
          <td width="20%" align="right"> <a accesskey="n" href="dbstat_print.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both"><a id="dbstat"></a>Db::stat()</h2>
          </div>
        </div>
      </div>
      <pre class="programlisting">#include &lt;db_cxx.h&gt;

int
Db::stat(void *sp, u_int32_t flags); </pre>
      <p>
         The <code class="methodname">Db::stat()</code> method creates a statistical structure and copies a
         pointer to it into user-specified memory locations.  Specifically, if
         <span class="bold"><strong>sp</strong></span> is non-NULL, a pointer to the
         statistics for the database are copied into the memory location to
         which it refers.
    </p>
      <p>
         The <code class="methodname">Db::stat()</code> <span>
            
            <span>
                method either returns a non-zero error value or throws an
                exception that encapsulates a non-zero error value on
                failure, and returns 0 on success.
            </span>
        </span>
    </p>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="idp5871280"></a>Parameters</h3>
            </div>
          </div>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idp5875080"></a>txnid</h4>
              </div>
            </div>
          </div>
          <p>
                  If the operation is part of an application-specified transaction, the
                  <span class="bold"><strong>txnid</strong></span> parameter is a transaction
                  handle returned from <a class="xref" href="txnbegin.html" title="DbEnv::txn_begin()">DbEnv::txn_begin()</a>; if the
                  operation is part of a Berkeley DB Concurrent Data Store group, the
                  <span class="bold"><strong>txnid</strong></span> parameter is a handle returned
                  from <a class="xref" href="envcdsgroup_begin.html" title="DbEnv::cdsgroup_begin()">DbEnv::cdsgroup_begin()</a>;
                  otherwise NULL. If no transaction handle is specified, but the
                  operation occurs in a transactional database, the operation will be
                  implicitly transaction protected.
             </p>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idp5844600"></a>flags</h4>
              </div>
            </div>
          </div>
          <p>
                  The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
                  or one of the following values:
             </p>
          <div class="itemizedlist">
            <ul type="disc">
              <li>
                <p><a id="stat_DB_FAST_STAT"></a>
                          <code class="literal">DB_FAST_STAT</code>
                     </p>
                <p>
                         Return only the values which do not require traversal of the database.
                         Among other things, this flag makes it possible for applications to
                         request key and record counts without incurring the performance
                         penalty of traversing the entire database.
                     </p>
              </li>
              <li>
                <p><a id="stat_DB_READ_COMMITTED"></a>
                          <code class="literal">DB_READ_COMMITTED</code>
                    </p>
                <p>
                         Database items read during a transactional call will have degree 2
                         isolation.  This ensures the stability of the data items read during
                         the stat operation but permits that data to be modified or deleted by
                         other transactions prior to the commit of the specified transaction.
                    </p>
              </li>
              <li>
                <p><a id="stat_DB_READ_UNCOMMITTED"></a>
                          <code class="literal">DB_READ_UNCOMMITTED</code>
                    </p>
                <p>
                         Database items read during a transactional call will have degree 1
                         isolation, including modified but not yet committed data.  Silently
                         ignored if the 
                         <a class="link" href="dbopen.html#dbopen_DB_READ_UNCOMMITTED">DB_READ_UNCOMMITTED</a> 
                         flag was not specified when the underlying database was opened.
                    </p>
              </li>
            </ul>
          </div>
        </div>
      </div>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="idp5895432"></a>Statistical Structure</h3>
            </div>
          </div>
        </div>
        <p>
                    Statistical structures are stored in allocated memory. If
                    application-specific allocation routines have been declared (see
                    <a class="xref" href="envset_alloc.html" title="DbEnv::set_alloc()">DbEnv::set_alloc()</a>
                    for more information), they are used to allocate the
                    memory; otherwise, the standard C library 
                    <span class="bold"><strong>malloc</strong></span>(3) is used. The caller is
                    responsible for deallocating the memory. To deallocate the memory, free the
                    memory reference; references inside the returned memory need not be
                    individually freed.
            </p>
        <p>
                If the DB_FAST_STAT flag has not been specified, the 
                <code class="methodname">Db::stat()</code> method will
                access some of or all the pages in the database, incurring a severe
                performance penalty as well as possibly flushing the underlying buffer pool.
            </p>
        <p>
                    In the presence of multiple threads or processes accessing an active
                    database, the information returned by DB-&gt;stat may be out-of-date.
            </p>
        <p>
                    If the database was not opened read-only and the DB_FAST_STAT flag was not
                    specified, the cached key and record numbers will be updated after the
                    statistical information has been gathered.
            </p>
        <p>
                    The <code class="methodname">Db::stat()</code> method may not be called before the 
                    <a class="xref" href="dbopen.html" title="Db::open()">Db::open()</a>
                    method is called.
            </p>
        <p>
                    The <code class="methodname">Db::stat()</code> method returns
                    a non-zero error value on failure and 0 on success. 
            </p>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idp5900920"></a>Hash Statistics</h4>
              </div>
            </div>
          </div>
          <p>
                        In the case of a Hash database, the statistics are stored in a
                        structure of type <code class="literal">DB_HASH_STAT</code>. The following fields will be filled
                        in:
                </p>
          <div class="itemizedlist">
            <ul type="disc">
              <li>
                <p>
                  <code class="literal">uintmax_t hash_bfree;</code>
                </p>
                <p>
                             The number of bytes free on bucket pages.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t hash_bigpages;</code>
                </p>
                <p>
                             The number of big key/data pages.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">uintmax_t hash_big_bfree;</code>
                </p>
                <p>
                             The number of bytes free on big item pages.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t hash_buckets;</code>
                </p>
                <p>
                              The number of hash buckets.  Returned if DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t hash_dup;</code>
                </p>
                <p>
                             The number of duplicate pages.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">uintmax_t hash_dup_free;</code>
                </p>
                <p>
                             The number of bytes free on duplicate pages.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t hash_ffactor;</code>
                </p>
                <p>
                              The desired fill factor (number of items per bucket) specified at
                              database-creation time.  Returned if DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t hash_free;</code>
                </p>
                <p>
                             The number of pages on the free list.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t hash_magic;</code>
                </p>
                <p>
                              Magic number that identifies the file as a Hash file. Returned if
                              DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t hash_metaflags;</code>
                </p>
                <p>
                              Reports internal flags. For internal use
                              only.
                          </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t hash_ndata;</code>
                </p>
                <p>
                              The number of key/data pairs in the database.  If DB_FAST_STAT was
                              specified the count will be the last saved value unless it has never
                              been calculated, in which case it will be 0. Returned if DB_FAST_STAT
                              is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t hash_nkeys;</code>
                </p>
                <p>
                              The number of unique keys in the database.  If DB_FAST_STAT was
                              specified the count will be the last saved value unless it has never
                              been calculated, in which case it will be 0. Returned if DB_FAST_STAT
                              is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t hash_overflows;</code>
                </p>
                <p>
                              The number of overflow pages (overflow pages are pages that contain
                              items that did not fit in the main bucket page).
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">uintmax_t hash_ovfl_free;</code>
                </p>
                <p>
                             The number of bytes free on overflow pages.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t hash_pagecnt;</code>
                </p>
                <p>
                              The number of pages in the database.  Returned if DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t hash_pagesize;</code>
                </p>
                <p>
                              The underlying database page (and bucket) size, in bytes.  Returned if
                              DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t hash_version;</code>
                </p>
                <p>
                              The version of the Hash database.  Returned if DB_FAST_STAT is set.
                         </p>
              </li>
            </ul>
          </div>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idp5911504"></a>Heap Statistics</h4>
              </div>
            </div>
          </div>
          <p>
                        In the case of a Heap database, the statistics are stored in a
                        structure of type <code class="literal">DB_HEAP_STAT</code>. The following fields will be filled
                        in:
                </p>
          <div class="itemizedlist">
            <ul type="disc">
              <li>
                <p>
                  <code class="literal">u_int32_t heap_magic;</code>
                </p>
                <p>
                              Magic number that identifies the file as a Heap file. Returned if
                              DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t heap_version;</code>
                </p>
                <p>
                              The version of the Heap database.  Returned if DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t heap_metaflags;</code>
                </p>
                <p>
                              Reports internal flags. For internal use
                              only.
                          </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t heap_nrecs;</code>
                </p>
                <p>
                                Reports the number of records in the Heap
                                database. Returned if DB_FAST_STAT is set.
                          </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t heap_pagecnt;</code>
                </p>
                <p>
                              The number of pages in the database.  Returned if DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t heap_pagesize;</code>
                </p>
                <p>
                              The underlying database page (and bucket) size, in bytes.  Returned if
                              DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t heap_nregions;</code>
                </p>
                <p>
                              The number of regions in the Heap database.  Returned if
                              DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t heap_regionsize;</code>
                </p>
                <p>
                              The number of pages in a region in the Heap database.  Returned if
                              DB_FAST_STAT is set.
                         </p>
              </li>
            </ul>
          </div>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idp5913056"></a>Btree and Recno Statistics</h4>
              </div>
            </div>
          </div>
          <p>
                    In the case of a Btree or Recno database, the
                    statistics are stored in a structure of type
                    <code class="literal">DB_BTREE_STAT</code>. The following fields
                    will be filled in:
                </p>
          <div class="itemizedlist">
            <ul type="disc">
              <li>
                <p>
                  <code class="literal">u_int32_t bt_dup_pg;</code>
                </p>
                <p>
                             Number of database duplicate pages.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">uintmax_t bt_dup_pgfree;</code>
                </p>
                <p>
                              Number of bytes free in database duplicate pages.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t bt_empty_pg;</code>
                </p>
                <p>
                             Number of empty database pages.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t bt_free;</code>
                </p>
                <p>
                             Number of pages on the free list.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t bt_int_pg;</code>
                </p>
                <p>
                             Number of database internal pages.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">uintmax_t bt_int_pgfree;</code>
                </p>
                <p>
                              Number of bytes free in database internal pages.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t bt_leaf_pg;</code>
                </p>
                <p>
                             Number of database leaf pages.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">uintmax_t bt_leaf_pgfree;</code>
                </p>
                <p>
                             Number of bytes free in database leaf pages.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t bt_levels;</code>
                </p>
                <p>
                             Number of levels in the database.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t bt_magic;</code>
                </p>
                <p>
                              Magic number that identifies the file as a Btree database.  Returned
                              if DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t bt_metaflags;</code>
                </p>
                <p>
                              Reports internal flags. For internal use
                              only.
                          </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t bt_minkey;</code>
                </p>
                <p>
                              The minimum keys per page.  Returned if DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t bt_ndata;</code>
                </p>
                <p>
                              For the Btree Access Method, the number of key/data pairs in the
                              database.  If the DB_FAST_STAT flag is not specified, the count will
                              be exact.  Otherwise, the count will be the last saved value unless it
                              has never been calculated, in which case it will be 0.                
                         </p>
                <p>
                              For the Recno Access Method, the number of records in the database. 
                              If the database was configured with mutable record numbers (see 
                              <a class="link" href="dbset_flags.html#dbset_flags_DB_RENUMBER">DB_RENUMBER</a>), 
                              the count will be exact.  Otherwise, if the DB_FAST_STAT flag is specified
                              the count will be exact but will include deleted and implicitly
                              created records; if the DB_FAST_STAT flag is not specified, the count
                              will be exact and will not include deleted or implicitly created
                              records.
                         </p>
                <p>
                             Returned if DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t bt_nkeys;</code>
                </p>
                <p>
                              For the Btree Access Method, the number of keys in the database.  If
                              the DB_FAST_STAT flag is not specified or the database was configured
                              to support record numbers (see 
                              <a class="link" href="dbset_flags.html#dbset_flags_DB_RECNUM">DB_RECNUM</a>), 
                              the count will be exact.  Otherwise, the count will be the last saved
                              value unless it has never been calculated, in which case it will be 0.
                         </p>
                <p>
                              For the Recno Access Method, the number of records in the database. 
                              If the database was configured with mutable record numbers (see 
                              <a class="link" href="dbset_flags.html#dbset_flags_DB_RENUMBER">DB_RENUMBER</a>), 
                              the count will be exact.  Otherwise, if the DB_FAST_STAT flag is specified
                              the count will be exact but will include deleted and implicitly
                              created records; if the DB_FAST_STAT flag is not specified, the count
                              will be exact and will not include deleted or implicitly created
                              records.
                         </p>
                <p>
                             Returned if DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t bt_over_pg;</code>
                </p>
                <p>
                             Number of database overflow pages.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">uintmax_t bt_over_pgfree;</code>
                </p>
                <p>
                              Number of bytes free in database overflow pages.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t bt_pagecnt;</code>
                </p>
                <p>
                              The number of pages in the database.  Returned if DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t bt_pagesize;</code>
                </p>
                <p>
                              The underlying database page size, in bytes.  Returned if DB_FAST_STAT
                              is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t bt_re_len;</code>
                </p>
                <p>
                              The length of fixed-length records.  Returned if DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t bt_re_pad;</code>
                </p>
                <p>
                              The padding byte value for fixed-length records.  Returned if
                              DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t bt_version;</code>
                </p>
                <p>
                              The version of the Btree database.  Returned if DB_FAST_STAT is set.
                         </p>
              </li>
            </ul>
          </div>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idp5946328"></a>Queue Statistics</h4>
              </div>
            </div>
          </div>
          <p>
                    In the case of a Queue database, the statistics are
                    stored in a structure of type
                    <code class="literal">DB_QUEUE_STAT</code>. The following fields
                    will be filled in:
                </p>
          <div class="itemizedlist">
            <ul type="disc">
              <li>
                <p>
                  <code class="literal">u_int32_t qs_cur_recno;</code>
                </p>
                <p>
                              Next available record number.  Returned if DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t qs_extentsize;</code>
                </p>
                <p>
                              Underlying database extent size, in pages.  Returned if DB_FAST_STAT
                              is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t qs_first_recno;</code>
                </p>
                <p>
                              First undeleted record in the database.  Returned if DB_FAST_STAT is
                              set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t qs_magic;</code>
                </p>
                <p>
                              Magic number that identifies the file as a Queue file.  Returned if
                              DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t qs_metaflags;</code>
                </p>
                <p>
                              Reports internal flags. For internal use
                              only.
                          </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t qs_nkeys;</code>
                </p>
                <p>
                              The number of records in the database.  If DB_FAST_STAT was specified
                              the count will be the last saved value unless it has never been
                              calculated, in which case it will be 0.  Returned if DB_FAST_STAT is
                              set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t qs_ndata;</code>
                </p>
                <p>
                              The number of records in the database.  If DB_FAST_STAT was specified
                              the count will be the last saved value unless it has never been
                              calculated, in which case it will be 0.  Returned if DB_FAST_STAT is
                              set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t qs_pages;</code>
                </p>
                <p>
                             Number of pages in the database.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t qs_pagesize;</code>
                </p>
                <p>
                              Underlying database page size, in bytes.  Returned if DB_FAST_STAT is
                              set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t qs_pgfree;</code>
                </p>
                <p>
                             Number of bytes free in database pages.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t qs_re_len;</code>
                </p>
                <p>
                              The length of the records.  Returned if DB_FAST_STAT is set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t qs_re_pad;</code>
                </p>
                <p>
                              The padding byte value for the records.  Returned if DB_FAST_STAT is
                              set.
                         </p>
              </li>
              <li>
                <p>
                  <code class="literal">u_int32_t qs_version;</code>
                </p>
                <p>
                              The version of the Queue file type.  Returned if DB_FAST_STAT is set.
                         </p>
              </li>
            </ul>
          </div>
        </div>
      </div>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="idp5927368"></a>Errors</h3>
            </div>
          </div>
        </div>
        <p>
                 The <code class="methodname">Db::stat()</code> <span>
            
            <span>
                method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 
                exception, encapsulating one of the following non-zero errors, or return one
                of the following non-zero errors:
            </span>
        </span>
            </p>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idp5925816"></a> <span>DbRepHandleDeadException or</span> DB_REP_HANDLE_DEAD</h4>
              </div>
            </div>
          </div>
          <p>
                When a client synchronizes with the master, it is possible for committed
                transactions to be rolled back. This invalidates all  the database and cursor
                handles opened in the replication environment. Once this occurs, an attempt to use
                such a handle will 
                <span>
                    throw a <a class="xref" href="dbrephandledead.html" title="DbRepHandleDeadException">DbRepHandleDeadException</a> (if
                    your application is configured to throw exceptions), or 
                </span>
                return <code class="literal">DB_REP_HANDLE_DEAD</code>.
                The application will need to discard the handle and open a new one in order to
                continue processing.
            </p>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idp5901416"></a><span>DbDeadlockException or </span>DB_REP_LOCKOUT</h4>
              </div>
            </div>
          </div>
          <p>
                The operation was blocked by client/master synchronization.
            </p>
          <p>
                <a class="xref" href="dbdeadlock.html" title="DbDeadlockException">DbDeadlockException</a> is thrown if
                your Berkeley DB API is configured to throw exceptions.
                Otherwise, <code class="literal">DB_REP_LOCKOUT</code> is returned.
            </p>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="idp5930368"></a>EINVAL</h4>
              </div>
            </div>
          </div>
          <p>
                An invalid flag value or parameter was specified.
            </p>
        </div>
      </div>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="idp5932296"></a>Class</h3>
            </div>
          </div>
        </div>
        <p>
            <a class="link" href="db.html" title="Chapter 2.  The Db Handle">Db</a>  
        </p>
      </div>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="idp5916464"></a>See Also</h3>
            </div>
          </div>
        </div>
        <p>
             <a class="xref" href="db.html#dblist" title="Database and Related Methods">Database and Related Methods</a> 
        </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="dbsort_multiple.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="db.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="dbstat_print.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">Db::sort_multiple() </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> Db::stat_print()</td>
        </tr>
      </table>
    </div>
  </body>
</html>