|  |  4.9.7 DBM links 
DBM links provide access to data stored in a data base.
Each entry in the data base consists of a (key_string,
value_string) pair. Such a pair can be inserted with the command
write(link,key_string,value_string).  By
callingwrite(link,key_string), the entry with key
key_string is deleted from the data base. The value of an entry is
returned by the commandread(link,key_string). With only one argument,read(link)returns the next key in the data base. Using this feature a
data base can be scanned in order to access all entries of the data base. 
If a data base with name nameis opened for writing for the first
time, two files (name.pagandname.dir), which contain the
data base, are automatically created. 
The DBM link describing string has to be one of the following:
 
 
"DBM: "+ nameopens the data base for reading (default mode).
 
"DBM:r "+ nameopens the data base for reading.
 
"DBM:rw "+ nameopens the data base for reading and writing.
 
Note that namemust be given without the suffix.pagor.dir. The name may contain an (absolute) path. 
Example:
 |  |   link l="DBM:rw example";
  write(l,"1","abc");
  write(l,"3","XYZ");
  write(l,"2","ABC");
  l;
==> // type : DBM
==> // mode : rw
==> // name : example
==> // open : yes
==> // read : ready
==> // write: ready
  close(l);
  // read all keys (till empty string):
  read(l);
==> 1
  read(l);
==> 3
  read(l);
==> 2
  read(l);
==> 
  // read data corresponding to key "1"
  read(l,"1");
==> abc
  // read all data:
  read(l,read(l));
==> abc
  read(l,read(l));
==> XYZ
  read(l,read(l));
==> ABC
  // close
  close(l);
 | 
 
 |