Hi all,

One reason why ORMs have an issue trying to map objects to tables is
the lack of distributed foreign keys.  They can be used to easily
handle subclassing, for example.  One explanation is at:

http://blogs.conchango.com/davidportas/archive/2007/01/08/Distributed-Keys-and-Disjoint-Subtypes.aspx
http://tinyurl.com/26hpwz

They can also be used to handle missing information (NULL values),
though the performance characteristics can be quite bad for this:

http://www.hughdarwen.freeola.com/TheThirdManifesto.web/Missing-info-without-nulls.pdf
http://tinyurl.com/ytzeyd

In any event, it would potentially be a useful feature to support in
Rose since I know of no SQL DBMS which supports this.  

For example, consider a 'My::Server' abstract base class, represented
by the 'servers' table.  An individual server in the 'servers' table
must be in the 'dedicated_servers' table or the 'shared_servers' table,
but not both.  Each of the latter tables would have a 'server_id' field
which a foreign key constraint against the 'servers' table.  Each
server record would have a distributed foreign key requiring that for
each server, there is one and only *one* corresponding record in *one*
of the other tables.  Does that make sense?

A simple syntax could be:

  distributed_keys =>  [
      server => {
          dedicated => {
              class       => 'My::Server::Dedicated',
              key_columns => { id => 'server_id' },
          },
          shared => {
              class       => 'My::Server::Dedicated',
              key_columns => { id => 'server_id' },
          },
      }
  ],

Cheers,
Ovid

--

Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to