Subject: | Alzabo fails to do join properly if a table does not have a pk |
If a join is attempted between table A, and table B, and table A does not have a primary key defined, join cursor ->next will return undef for table A object.
An example:
Table A:
QuestionID (not defined as a primary key),
QuestionText
Table B:
AnswerID (primary key)
QuestionID (forign key, properly linked to TableA)
$schema->join( join => [ $A, $B] );
will return cursor that returns
[undef, "Table B row object"]
...
I got this on a reverse engineered MySql database that had a similar structure. As soon as I defined what the primary key is in A, it works ok. None of the tables had primary keys defined in the DB (the DB was a dumb dump of an MSSQL), but alzabo guessed what the primary keys are for some tables. for TestQuestions, it did not manage to guess that the key is QuestionID....
Just wondering if this is a bug.. It should not impact our production enviroment since we do have a proper DB layout - the thing I was testing Alzabo on was the old system that we need to migrate the data from ...
Thanks!
Cheers,
bojan
PS Like Mason A LOT. Reported a bug or two a while ago, and got credit for it! THANKS!