1SNOBOL4DBM(1)               General Commands Manual              SNOBOL4DBM(1)
2
3
4

NAME

6       snobol4dbm - SNOBOL4 NDBM interface
7
8

SYNOPSIS

10       -INCLUDE 'ndbm.sno'
11
12       dbhandle = DBM_OPEN(file,flags,mode)
13
14       DBM_CLOSE(dbhandle)
15
16       DBM_STORE(dbhandle,key,datum,flags)
17
18       datum = DBM_FETCH(dbhandle,key)
19
20       DBM_DELETE(dbhandle,key)
21
22       key = DBM_FIRSTKEY(dbhandle)
23
24       key = DBM_NEXTKEY(dbhandle)
25
26       DBM_ERROR(dbhandle)
27
28       DBM_CLEARERR(dbhandle)
29
30

DESCRIPTION

32       "NDBM"  (for  New  Data  Base  Managemnt)  is an industry standard fast
33       hashed storage API first created in 4.3BSD, and included in the Unix 98
34       (SUSv2)  standard.  The original DBM API appeared in AT&T Research Unix
35       Version 7, and only allowed access to a single file at a time.
36
37
38       There are many different implementations of this API, including:
39
40
41       ·      The original BSD 4.3 ndbm, based on AT&T dbm. Found  in  commer‐
42              cial Un*x offerings.
43
44
45       ·      Berkeley  DB  v1  compatibility interface.  Supplied with 4.4BSD
46              based systems: (Free|Open|Net)BSD, MacOS X.
47
48
49       ·      GNU DBM (GDBM) found in Linux distributions.
50
51
52       ·      SDBM, Ozan Yigit's Public Domain implementation of  NDBM.   Sup‐
53              plied  with this distribution, and used as a last resort on Un*x
54              systems (and by default on non Un*x systems).
55
56
57       DBM_OPEN takes a filename (STRING), flags (either  "R"  for  read-only,
58       "W"  for  write  access, or "CW" to create and write a new file), and a
59       "mode" string, which defaults to "0660" (octal) and returns a  database
60       handle which can be passed to the remaining functions.
61
62
63       DBM_CLOSE closes the database file.  DBM_CLOSE MUST be called to ensure
64       that all your data is written.
65
66
67       DBM_STORE takes a database handle, key and datum strings,  and  a  flag
68       (either  DBM_INSERT  to  insert  a new pair, or fail if the key already
69       exists, or DBM_REPLACE to insert or replace existing  data).   The  key
70       and datum strings may contain an arbitrary series of characters.
71
72
73       DBM_FETCH  returns  the  stored datum (if any) for the supplied key, or
74       fails.
75
76
77       DBM_DELETE deletes the stored datum (if any) for the supplied  key,  or
78       fails.
79
80
81       DBM_FIRSTKEY  and subsequent calls to DBM_NEXTKEY allow you to traverse
82       all stored keys.  The keys will be returned in arbitrary order, and the
83       routines will fail at the end of the traversal.
84
85
86       DBM_ERROR is a predicate which succeeds if the database handle is valid
87       and an I/O error has occurred on the file.  DBM_CLEARERR is a predicate
88       which  succeeds  if  if  the database handle is valid, and has the side
89       effect of clearing the I/O error flag.
90
91

FILES

93       NDBM, GDBM, and SDBM  create  two  files:  filename.dir,  filename.pag.
94       Berkeley DB creates a single filename.db file.
95
96

SEE ALSO

98       ndbm(3), dbopen(3), gdbm(3).
99
100

AUTHOR

102       Philip L. Budne
103
104

BUGS

106       None of the implementations allow concurrent read and write.
107
108
109       Some  implementations (classic NDBM and SDBM) place limits on the total
110       size of key plus datum (typically slightly less than 1KB).
111
112
113       NOTE: Some implementations (classic NDBM and SDBM) create  sparse  file
114       which  appear  (to  "ls  -l") to be larger than they are (see "ls -s").
115       Copying such files may cause the non-allocated blocks  to  be  "filled"
116       with zeroed disk blocks, and then the files really will be large!
117
118
119       Only GDBM provides locking to eliminate the possibility of file corrup‐
120       tion, or reading of incomplete data.
121
122
123       GDBM locking sometimes fails on NFS mounted partitions (particularly on
124       Linux  systems).   GDBM's NDBM interface does not provide a way to dis‐
125       able locking.
126
127
128       DBM databases accessed concurrently by multiple  processes  are  tradi‐
129       tionally (re)created from text files and used for fast disk-based read-
130       only table lookups.  Programs which need to update the file generate  a
131       new  temporary  copy  using  a  different name, and then rename the new
132       file(s), so that the next reader gets the new copies (existing  readers
133       continue to see old data).
134
135
136
137Local                             3 Dec 2005                     SNOBOL4DBM(1)
Impressum