[CDBI] Join problem

Michael Reece mreece at vinq.com
Tue Dec 5 19:26:14 GMT 2006


> Domain->has_a(
>
>                          contact_id => 'Contact',
>
>                          admin_id => 'Contact'
>
> );

that won't work.  try:

Domain->has_a(contact_id => 'Contact');
Domain->has_a(admin_id => 'Contact');



On Dec 5, 2006, at 11:14 AM, Evgeny Morozov wrote:

> Hello,
>
> I’ve just started using Class::DBI and immediately hit a problem.  
> Suppose, I have two tables:
>
> create table domains (
>
>   name varchar(255),
>
>   contact_id integer foreign key references contacts(id),
>
>   admin_id integer foreign key references contacts(id)
>
> )
>
>
>
> and
>
>
>
> create table contacts (
>
>   id integer,
>
>   name varchar(255)
>
> )
>
>
>
> And I’ve defined class Domain as:
>
> Domain->table('domains');
>
> Domain->columns(
>
>                                    All => qw/name created
>
>                                    contact_id
>
> admin_id/
>
> );
>
> Domain->has_a(
>
>                          contact_id => 'Contact',
>
>                          admin_id => 'Contact'
>
> );
>
>
>
> The problem is that objects returned by Domain->search will returns  
> correct contact_id object but admin_id is always empty.
>
> I guess that generated sql is incorrect, but I don’t understand how  
> hand-written sql code for set_sql method should look in this case.
>
> Eugene
>
>
>
> --
>
> Eugene Morozov
>
> http://eugenemorozov.name
>
>
>
> _______________________________________________
> ClassDBI mailing list
> ClassDBI at lists.digitalcraftsmen.net
> http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

---
michael reece :: software engineer :: mreece at vinq.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digitalcraftsmen.net/pipermail/classdbi/attachments/20061205/fe8ea22d/attachment.htm


More information about the ClassDBI mailing list