CLOS-DB is a database interface for the Common Lisp Object System. It was designed and prototypically implemented by Christoph Wernhard within the Databases and Information-Systems Group at Freie Universität Berlin between 1989 and 1992.
CLOS-DB is a database interface for the Common Lisp Object System.
At the definition of classes with the metaclass
(live db classes resp. snapshot db classes), a
database correspondence can be specified.
Valid superclasses of db classes are classes with the metaclass
standard-class and other db classes, where the database
correspondence is inherited.
Instances of db classes can be created for given database related object identifiers (e.g. relational key values). Creation of many instances of a class corresponding to a single such object identifier can be suppressed: the instances are then identified by their class and the object identifier. Instances of db classes can also be created (or identified) setwise corresponding to a given search condition and as members of a given class (instances of the class and its subclasses).
An instance of a live db class at each point of time represents the database in its actual state: database updates, that are executed whenever a slot is written, can be specified; slots and object identities can be invalidated to reflect changes in the database (the data corresponding to the instance then are loaded from the database anew); subobjects can be lazily created.
An instance of a snapshot db class represents a "snapshot" of the database at a certain point of time. No database updates can be associated with snaphot db instances, they can not be invalidated and subobjects may not be created lazily.
Instances of live db classes as well as snapshot db classes can have "normal" slots without database correspondence. Instances of live db classes can have "snapshot" slots which represent the database at a certain point of time.
The connection to relational databases is implemented using Database Representatives, a lower level database interface that makes relational databases accessible through interpreters for database queries and commands. This lower level interface remains visible in the CLOS-DB programmer interface.
CLOS-DB can be portably implemented using the CLOS Metaobject Protocol AMOP.