[CDBI] Join problem
Evgeny Morozov
emorozov at intermedia.net
Tue Dec 5 19:14:13 GMT 2006
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digitalcraftsmen.net/pipermail/classdbi/attachments/20061205/de975b7e/attachment.html
More information about the ClassDBI
mailing list