|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
dbm- Generic DBM interface
This modules defines
<dbm> abstract class, which has
a common interface to use various DBM-type database packages.
As far as you operate on the already opened database,
dbm module is enough.
To create or open a database, you need a concrete implementation of the database. Gauche currently has the following impelentations. Each module defines its own low-level accessing functions as well as the common interface. Note that your system may not have one or more of those DBM libraries; Gauche defines only what the system provides.
dbm.gdbm- GDBM interface).
dbm.ndbm- NDBM interface).
dbm.odbm- Original DBM interface).
The following code shows a typical usage of the database.
(use dbm) ; dbm abstract interface (use dbm.gdbm) ; dbm concrete interface ; open the database (define *db* (dbm-open <gdbm> :path "mydb" :rw-mode :write)) ; put the value to the database (dbm-put! *db* "key1" "value1") ; get the value from the database (define val (dbm-get *db* "key1")) ; iterate over the database (dbm-for-each *db* (lambda (key val) (foo key val))) ; close the database (dbm-close *db*)
11.1.1 Opening and closing a dbm database 11.1.2 Accessing a dbm database 11.1.3 Iterating on a dbm database