[net.unix] Multiple DBM databases?

dave@uwmcsd1.UUCP (Dave Rasmussen) (09/19/85)

I have an application where I'd like to set up 4 DBM type databases.
However, from looking at the documentation, I assume I would have to
deal with one at a time. Am I correct? Is there a way to 'talk' to
4 of these animals at once besides hacking dbm up?

UUCP: {ihnp4,uwvax!uwmacc}!uwmcsd1!dave
ARPA: uwmcsd1!dave@wisc-rsch.arpa

jeff@ssc-vax.UUCP (Jeffrey Jongeward) (09/24/85)

> 
> I have an application where I'd like to set up 4 DBM type databases.
> However, from looking at the documentation, I assume I would have to
> deal with one at a time. Am I correct? Is there a way to 'talk' to
> 4 of these animals at once besides hacking dbm up?
> 
> UUCP: {ihnp4,uwvax!uwmacc}!uwmcsd1!dave
> ARPA: uwmcsd1!dave@wisc-rsch.arpa

There is no easy way because of the declaration of pagbuf and dirbuf in dbm.h 
(as character arrays), and becuase of a couple of static internal variables in 
dbm.c.  If you have the source, you can just change the declarations of pagebuf 
and dirbuf in dbm.h (to char pointers), change the static internals to external
unique variables, declare some per-database storage for pagebuf and dirbuf, then
switch from one dbm database to the other by saving and restoring the necessary 
variables w/in dbm.h + the (old) static internal variables.

I have a set of high-level routines that do just this if you want them (plus a 
diff script for dbm), however, it's really a trivial task to write your own.  

wombat@ccvaxa.UUCP (09/26/85)

If you have a copy of Gosling emacs, the dbm with it (called ndbm) is able
to deal with more than one database file. Also, I think I heard that the dbm
to be distributed with 4.3 will handle multiple databases.

"When you are about to die, a wombat is better than no company at all."
				Roger Zelazny, *Doorways in the Sand*

						Wombat
					ihnp4!uiucdcs!ccvaxa!wombat