NDBM Question

NDBM Question

Post by Neil Hain » Wed, 11 Jun 1997 04:00:00

   Does anyone know of a way to compress ndbm ".pag" files?  
We are using Network Node Manager and we have one ndbm file
( $OV_DB/openview/ovwdb/current/value_info.pag ) that is 978 megabytes!  

1.  What causes these sparse files to be four times their actual content;
as the man page states:

   The .pag file will contain holes so that its apparent size is      
   about four times its actual content.  Some older UNIX systems      
   create real file blocks for these holes when touched.  These files
   cannot be copied by normal means (such as cp(1), cat(1), tar(1),  
   or ar(1)) without expansion.

2.  The key is stored in the ".dir" file, but, will it's length
( 2 byte key vs 1024 byte key ) impact the size of the ".pag" file?

3.  What procedures ( if any ) are available to manage ndbm files?




1. ndbm questions

Can someone please tell me what i'm doing wrong here?

DBM *db;
datum key, value;

db = dbm_open("./foo", O_CREAT, 0644);
if (db == (DBM *)NULL) {
        blah; blah;
key.dptr = (char *)malloc(sizeof(char)*256);
strcpy(key.dptr, "mthomas");
key.dsize = strlen(key.dptr) + 1;
value.dptr = (char *)malloc(sizeof(char)*256);
strcpy(value.dptr, "mark thomas");
value.dsize = strlen(value.dptr) + 1;

dbm_store(db, key, value, DBM_INSERT);

/* later on in the code.. */

db = dbm_open("./foo", O_RDWR);
gets(name); /* char name[256]; */
key.dptr = name;
key.dsize = strlen(key.dptr) + 1;
value = dbm_fetch(db, key);

/* etc, etc etc */

the initial store is not working.. any ideas why? i've tried the
approach i wrote above, i tried writing the strings to intermediate
arrays, setting {key,value}.dptr to the two arrays, respectively and
it still didn't work.  the file is created, with the right perms, etc.
it just doesn't want to write to the file, any ideas why?

this is the first time i've tried to use this, so humor me if
made a dumb mistake.  thanks.  :)

please email me any replies, as i haven't had the time lately to keep
up on these groups, and i'm way behind.  thanks so much!

Mark Thomas          
The Internet Company
96 Sherman Street  
Cambridge, MA 02140
(617) 547-4731    

2. E-mail archive script?

3. NDBM Question

4. Red Hat Package Management

5. Question on how to use ndbm

6. Turning swapon dering boot?

7. ndbm database questions

8. Changing http to https??

9. New NDBM Authentication question

10. questions regarding databases created with dbm and ndbm routines

11. PROGRAMMING: *Simple* ndbm problem.

12. why are my ndbm files huge?

13. Perl5, ndbm, gdbm, db