Re: [CDBI] Join problem

Michael Reece <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
> 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-Ra3b/[email protected]
> http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

---
michael reece :: software engineer :: [email protected]

_______________________________________________
ClassDBI mailing list
ClassDBI-Ra3b/[email protected]
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.