xref: /csrg-svn/lib/libc/db/hash/README (revision 61199)
1*61199Sbostic#	@(#)README	8.1 (Berkeley) 06/04/93
246363Sbostic
346363SbosticThis package implements a superset of the hsearch and dbm/ndbm libraries.
446363Sbostic
546363SbosticTest Programs:
646363Sbostic	All test programs which need key/data pairs expect them entered
746363Sbostic	with key and data on separate lines
846363Sbostic
946363Sbostic	tcreat3.c
1046363Sbostic		Takes
1146363Sbostic			bucketsize (bsize),
1246363Sbostic			fill factor (ffactor), and
1346363Sbostic			initial number of elements (nelem).
1446363Sbostic		Creates a hash table named hashtest containing the
1546363Sbostic		keys/data pairs entered from standard in.
1646363Sbostic	thash4.c
1746363Sbostic		Takes
1846363Sbostic			bucketsize (bsize),
1946363Sbostic			fill factor (ffactor),
2046363Sbostic			initial number of elements (nelem)
2146363Sbostic			bytes of cache (ncached), and
2246363Sbostic			file from which to read data  (fname)
2346363Sbostic		Creates a table from the key/data pairs on standard in and
2446363Sbostic		then does a read of each key/data in fname
2546363Sbostic	tdel.c
2646363Sbostic		Takes
2746363Sbostic			bucketsize (bsize), and
2846363Sbostic			fill factor (ffactor).
2946363Sbostic			file from which to read data (fname)
3046363Sbostic		Reads each key/data pair from fname and deletes the
3146363Sbostic		key from the hash table hashtest
3246363Sbostic	tseq.c
3346363Sbostic		Reads the key/data pairs in the file hashtest and writes them
3446363Sbostic		to standard out.
3546363Sbostic	tread2.c
3646363Sbostic		Takes
3746363Sbostic			butes of cache (ncached).
3846363Sbostic		Reads key/data pairs from standard in and looks them up
3946363Sbostic		in the file hashtest.
4046363Sbostic	tverify.c
4146363Sbostic		Reads key/data pairs from standard in, looks them up
4246363Sbostic		in the file hashtest, and verifies that the data is
4346363Sbostic		correct.
4446363Sbostic
4546501SbosticNOTES:
4646363Sbostic
4746501SbosticThe file search.h is provided for using the hsearch compatible interface
4846501Sbosticon BSD systems.  On System V derived systems, search.h should appear in
4946363Sbostic/usr/include.
5046363Sbostic
5151045SbosticThe man page ../man/db.3 explains the interface to the hashing system.
5246363SbosticThe file hash.ps is a postscript copy of a paper explaining
5346363Sbosticthe history, implementation, and performance of the hash package.
5446501Sbostic
5546501Sbostic"bugs" or idiosyncracies
5646501Sbostic
5746501SbosticIf you have a lot of overflows, it is possible to run out of overflow
5846501Sbosticpages.  Currently, this will cause a message to be printed on stderr.
5946501SbosticEventually, this will be indicated by a return error code.
6046501Sbostic
6146501SbosticIf you are using the ndbm interface and exit without flushing or closing the
6246501Sbosticfile, you may lose updates since the package buffers all writes.  Also,
6346501Sbosticthe db interface only creates a single database file.  To avoid overwriting
6446501Sbosticthe user's original file, the suffix ".db" is appended to the file name
6546501Sbosticpassed to dbm_open.  Additionally, if your code "knows" about the historic
6646501Sbostic.dir and .pag files, it will break.
6746501Sbostic
6846501SbosticThere is a fundamental difference between this package and the old hsearch.
6946501SbosticHsearch requires the user to maintain the keys and data in the application's
7046501Sbosticallocated memory while hash takes care of all storage management.  The down
7146501Sbosticside is that the byte strings passed in the ENTRY structure must be null
7246501Sbosticterminated (both the keys and the data).
73