module Dbm:sig..end
type t
type open_flag =
| |
Dbm_rdonly |
|||
| |
Dbm_wronly |
|||
| |
Dbm_rdwr |
|||
| |
Dbm_create |
(* |
Flags for opening a database (see
Dbm.opendbm). | *) |
exception Dbm_error of string
val opendbm : string -> open_flag list -> int -> t.dir and .pag suffixes).
The second argument is a list of flags: Dbm_rdonly opens
the database for reading only, Dbm_wronly for writing only,
Dbm_rdwr for reading and writing; Dbm_create causes the
database to be created if it does not already exist.
The third argument is the permissions to give to the database
files, if the database is created.val close : t -> unitval find : t -> string -> stringfind db key returns the data associated with the given
key in the database opened for the descriptor db.
Raise Not_found if the key has no associated data.val add : t -> string -> string -> unitadd db key data inserts the pair (key, data) in
the database db. If the database already contains data
associated with key, raise Dbm_error "Entry already exists".val replace : t -> string -> string -> unitreplace db key data inserts the pair (key, data) in
the database db. If the database already contains data
associated with key, that data is discarded and silently
replaced by the new data.val remove : t -> string -> unitremove db key data removes the data associated with key
in db. If key has no associated data, raise
Dbm_error "dbm_delete".val firstkey : t -> stringDbm.nextkey.val nextkey : t -> stringfirstkey db returns the first key, and repeated calls
to nextkey db return the remaining keys. Not_found is raised
when all keys have been enumerated.val iter : (string -> string -> 'a) -> t -> unititer f db applies f to each (key, data) pair in
the database db. f receives key as first argument
and data as second argument.