Jeff Abrahamson on Fri, 20 Dec 2002 16:01:07 -0500


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] BerkeleyDB and db_stat


Any BerkeleyDB users in the audience? There doesn't seem to be a
specific mailing list for BerkeleyDB. So I'll try here.

I have a database with one key/value pair in it. I execute the
following code snippet. The DB *dbp is valid, I go on to read from it
just fine.

        if(dbp->stat(dbp, &sp, 0)) {
                fprintf(stderr, "Can't get statistics on database %s:%s\n",
                        filename, db_name);
        } else {
                fprintf(stderr, "Statistics for %s:%s\n", filename, db_name);
                fprintf(stderr, "  num unique keys = %d\n", sp.hash_nkeys);
                fprintf(stderr, "  num key/data pairs = %d\n", sp.hash_ndata);
                /*free(sp);*/
        }

I expect to see

    Statistics for /home/dev/.cryptar/test/db:filename
      num unique keys = 1
      num key/data pairs = 1

But what I actually see is

    Statistics for /home/dev/.cryptar/test/db:filename
      num unique keys = 0
      num key/data pairs = 18

Huh? I confirmed with db_dump (er, db4.0_dump: thanks, debian) that
there's really only one key.

-- 
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>
 GPG fingerprint: 1A1A BA95 D082 A558 A276  63C6 16BF 8C4C 0D1D AE4B

Attachment: pgpChYHiC9Fpc.pgp
Description: PGP signature