[CDBI] Join problem

"Evgeny Morozov" <emorozov-n7suLNCBRUt2MFLXGSI/[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
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
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.