[Dbix-class] Prefetch and join on different tables
mpm
mpmagarinos at gmail.com
Fri Jan 18 20:06:26 GMT 2013
Hello,
I am performing a join between a table 'mdata', that has a 'has many'
relationship with 'mc' and 'mt'. $where contains conditions over mc and mt,
and I want all columns of mc and mdata in the result. So I prefetch mc:
push @{ $attr->{join} }, 'mt';
push @{ $attr->{join} }, 'mc';
my $rs1 = $c->model('weight::Mdata')->search( $where, $attr,{prefetch =>
'mc'});
while ($cand = $rs1->next()) {
$h1 = $cand-> get_column('h1');
...
...
}
And the following error occurs:
[error] DBIx::Class::ResultSet::next(): DBI Exception: DBD::mysql::st
execute failed: Unknown column 'mt.n_C' in 'where clause'
I don't know why but it is not performing the join with mt, only the
prefetch with mc. If I change the prefetch and I prefetch mt, the same
happens but with mc. Is it possible to perform prefetch and join of
different tables?
--
View this message in context: http://dbix-class.35028.n2.nabble.com/Prefetch-and-join-on-different-tables-tp7577937.html
Sent from the DBIx-Class mailing list archive at Nabble.com.
More information about the DBIx-Class
mailing list