Normalized view classes

"Scott L. Burson" <[email protected]> Sat, 24 Dec 2011 12:02:31 -0800
Newsgroups gmane.lisp.clsql.general
Message-ID <CAF5LJ4ARJ9E+seEmQg1aFu94HNRJHe5WF63+kpSWzyw7hPaU+w@mail.gmail.com>
Hi all,

How many people use normalized view classes?  I ask because I am
trying to use them, but they don't work the way I think they should.
I am wondering if others agree with me.

Here is how I think they should work:

() Tne declaration should go on the root class rather than on each
subclass.  So, instead of saying

  (def-view-class A () (...))
  (def-view-class B (A) (...) (:normalizedp t))

you would say

  (def-view-class A () (...) (:normalized-subclasses t))

and then all subclasses of A would automatically be normalized.

() The primary key of each normalized subclass should automatically be
the same as that of the root; you shouldn't have to provide an
explicit primary key slot (currently these wind up as redundant slots
in the instance).

() An internal slot and column should be added to the root class to
record the actual class of the instance.

() Retrieving an instance from the root class's table should turn it
into the correct actual class and perform the additional select(s)
required to populate it.

This way, a join slot of some other class could specify the root of
this hierarchy as its join class, and the value(s) in the join slot
would automatically come out as the correct actual classes.

What do you think?

-- Scott