Re: Loader and relationships
[prev]
[thread]
[next]
[Date index for 2005/03/16]
On Mon, 2005-03-14 at 19:46 +0100, Sebastian Riedel wrote:
> Andreas Fromm wrote:
> > The thing I'm missing is the posibility to let Loader just set up some
> > of the relations, e.g. only the has_a relations, because some of my
> > tables links to another tables many times (Person:phone_home->
> > PhoneNumbers, Person:phone_work-> PhoneNumbers, ...). In this case the
> > automatic registration of the has_many relationships fail.
>
> I don't really grok what you want but have a look at constraint and exclude.
As I understand it, in Class::DBI::Loader, -constraint is just a regexp
of table names to include (tested first), and "-exclude" is a regexp of
table names to exclude (tested second). It doesn't give you any control
over what types of relationships Loader.pm will try to define.
[ BTW: Option -exclude is NOT DOCUMENTED in lastest ::Loader 0.17 ]
I have also encountered the "error" Andreas is describing, consider the
case where a table has two foreign keys to the same other table.
TABLE a (id SERIAL, name TEXT);
TABLE b (id SERIAL, foo REFERENCES a, bar REFERENCES a);
I think Loader.pm gets confused and trys to re-define some methods
for "bar" that "foo" has already namespaced.
--
Torsten Seemann <torsten.seemann@xxxxxxxx.xxxxxx.xxx.xx>
Victorian Bioinformatics Consortium