Next Prev Up Top Contents Index

16.4.2 Object-Oriented Data Definition Language (OODDL)

The OODDL lets you define a mapping between the relational and object-oriented worlds to be defined. Through the mapping a CLOS object can effectively denote a collection of records in a database view, and can contain pointers to other view-based CLOS objects. The CLOS object makes explicit an object implicitly described by the flat relational values.

The mapping is defined using the macro def-view-class. This extends the syntax of defclass to allow special base slots to be mapped onto the attributes of database views (presently single tables). When you submit a select query that names a View Class (that is, a class defined by def-view-class ), then the corresponding database view is queried, and the slots in the resulting instances are filled with attribute values from the database.

It is also possible to create join slots and virtual (ordinary) slots .

All the special slots are distinguished by a modified set of class and slot options. The special slots and their options are described in more detail under def-view-class in the LispWorks Reference Manual .

Note: def-view-class defines a Lisp view of an underlying database table. It is a similar concept to that of SQL VIEWs, but does not interact with them.

You can create a table based on a View Class using the function create-view-from-class and delete it using the function drop-view-from-class .

16.4.2.1 Example View Class definition


LispWorks User Guide - 18 Feb 2003

Next Prev Up Top Contents Index