Hi, I have two related tables, using one-to-one. The second table is the 
prolongation of the first one (old structure; too much columns for the ancient 
db engine where it was created; and it can´t be changed). Most of the time I 
need to retrieve data form the two tables.

I have a Result set for it executed from a Controller in Catalyst. And because 
it is MySql MyIsam I added the "has_one" relationship in the Result schema by 
hand.

return 
$self->search(the_main_query_to_search_the_main_rows)->search_related(the_has_one_accessor)

The query retrieves just the expected rows (using columns of the first table 
for WHERE and ORDER). But the SELECT only contains the columns and data from 
the related, secondary table!!!! Nothing from the first one.

I can see the executed SELECT with the DBIC_TRACE, and it only calls for 
columns in the related table. The rs object for the template is filed with data 
from the secondary.

I tried to specify the columns using "columns => " and they appear in the 
query. Fine. But the only objects available in the Template Toolkit rs object 
are the ones from the related, secondary table.

So I am sure that I am missing something or misunderstanding the whole concept 
of the DBIC query.

Regards:
Migue.
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to