Subject: Binary data in the Berkeley database code.
To: None <current-users@NetBSD.ORG, netbsd-help@NetBSD.ORG>
From: Brian Buhrow <buhrow@cats.ucsc.edu>
List: netbsd-help
Date: 04/22/1997 16:34:19
	hello NetBSD users.  I realize this question is slightly off topic for
the lists, but since the Berkeley database (*.db files) is used in NetBSD,
I'm wondering if  anyone knows the answer to this question.  I've been
looking for several days, and can't seem to get a definitive sentence on
the topic.
	I'm trying to write an application that wants to store some binary
data in a little ".db" database.  In order for backward compatibility, I'm
using the ndbm compatibility routines to interface with the db package.
The problem I'm having is that when I create a database and put data into
it, I can't seem to get any accurate data out of it.  I'm using null
terminated strings as keys, and binary structures as data.  The structures
are about 20 bytes long with some 0 bytes in the middle of them.  Should
this work?
	The man pages from the old SunOS set say that dbm_store() takes:
dbm_store(db, key, content, flags)
Yet if I pass in a datum with a key and a datum with the structure of data,
when I walk through the resultant database,  all I get are the keys
returned to me.  If I reverse the two parameters, (i.e. dbm_store(db,
content, key, flags)), I get the contents returned to me when I walk
through the data, but am unable to look anyone up by key.
Anyone have any ideas on what is going on?
	Any help on what to look at or suggestions on what stupid pointer I
got wrong would be greatly appreciated.  If you need to see sample code
fragments, let me know and I'll send them individually; I don't want to
flood the list.
-Thanks
-Brian