[Dbix-class] combining tables

Dave Howorth dhoworth at mrc-lmb.cam.ac.uk
Thu Jun 17 14:42:57 GMT 2010


Rob Kinyon wrote:
> That's called a view. Use that keyword when searching.

My google-foo apparently isn't strong enough. My searching hasn't thrown
up any hits that look relevant. Can you give me a bigger hint please? Or
even an actual URL.

> Though, I'd seriously consider refactoring your schema.

Agreed. Sadly, it's not my schema to refactor. I just have read access.

Cheers, Dave

> On Thu, Jun 17, 2010 at 09:56, Dave Howorth <dhoworth at mrc-lmb.cam.ac.uk> wrote:
>> Is there way to present a merged view of some tables using DBIx::Class?
>>
>> Imagine I have three tables:
>>
>> pig (
>>    pig_id    INT,
>>    pig_name  TEXT,
>>    colour    ENUM ('brown', 'black', 'white),
>> );
>>
>> cow (
>>    cow_id    INT,
>>    cow_name  TEXT,
>>    colour    ENUM ('brown', 'black', 'white),
>> );
>>
>> sheep (
>>    sheep_id    INT,
>>    sheep_name  TEXT,
>>    colour      ENUM ('brown', 'black', 'white),
>> );
>>
>> What's more, the values of pig_id, cow_id and sheep_id are disjoint.
>>
>> I'd like DBIC to present them as though they were a single table
>>
>> animal (
>>    id      INT,
>>    name    TEXT,
>>    colour  ENUM ('brown', 'black', 'white),
>> );
>>
>> Is there some way to do that?
>>
>> Thanks, Dave
>>
>> _______________________________________________
>> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
>> IRC: irc.perl.org#dbix-class
>> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
>> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>>
> 
> 
> 




More information about the DBIx-Class mailing list