Using CDBI with an ORDBMS

[prev] [thread] [next] [Date index for 2005/04/30]

From: Michael Nachbaur
Subject: Using CDBI with an ORDBMS
Date: 00:16 on 30 Apr 2005
I'm designing a database schema that uses the ORDBMS table inheritance 
features of PostgreSQL to make two tables inherit from a common third table.

I wanted to know if there was any way within Class::DBI to express that 
relationship, so it will DWIM.  Consider the following pseudo-SQL:

CREATE TABLE Bookmark (target) INHERITS (URI);
CREATE TABLE Folder (entries) INHERITS (URI);
CREATE TABLE URI (id, name, description);

If I insert a record into either tables Bookmark or Folder, it will show 
up in URI as well, though only with the columns defined within URI.

Therefore, I wanted to have Class::DBI return the appropriate object 
type when I query from the URI table.  For instance:

my $obj = URI->retrieve(10);

If ID 10 is a Folder, I would expect it to return a Class::DBI object 
for the folder class, giving me the columns "id", "name", "description", 
and "entries".

Is there a way of doing this currently with Class::DBI, or do I need to 
create a new module to accomodate this?

Thanks.

        -- 
        Michael Nachbaur <mike@xxxxxxxx.xxx>
http://nachbaur.com/pgpkey.asc

Using CDBI with an ORDBMS
Michael Nachbaur 00:16 on 30 Apr 2005

Re: Using CDBI with an ORDBMS
merlyn (Randal L. Schwartz) 03:36 on 30 Apr 2005

Re: Using CDBI with an ORDBMS
Tony Bowden 09:12 on 30 Apr 2005

Re: Using CDBI with an ORDBMS
David Christensen 12:06 on 30 Apr 2005

Re: Using CDBI with an ORDBMS
merlyn (Randal L. Schwartz) 17:44 on 30 Apr 2005

Generated at 10:24 on 04 May 2005 by mariachi v0.52