in reply to Class::DBI and might_have problem

First, either use might_have or has_a, not both. Second, if multiple authors may have the same value in the articleId field, might_have will not work. You'd need has_many instead. Finally, Class::DBI doesn't do joins so it will never write SQL like the example you wrote. It will do something like this instead:
SELECT authorId FROM author WHERE articleId = 5

Replies are listed 'Best First'.
Re^2: Class::DBI and might_have problem
by debiandude (Scribe) on Jun 07, 2006 at 19:40 UTC

    Multiple authors cannot have the same value in the articleId field since each article has only one author (its creator). Also I didn't mean to put both has_a and might_have in the code, it was just that in the module I was playing around in I was flipping between them (since has_a was working but might_have was not) to try to figure what was going wrong.