Paula wrote:
If the search is:
my $rs1 = $c->model('weight::Mdata')->search($where,$attr,{prefetch =>
'mc'},{join =>'mt'});
The DBIC TRACE shows that the join occurs between mdata and mt, and I
get the following error:
[error] DBIx::Class::ResultSet::next(): DBI Exception: DBD::mysql::st
execute failed: Unknown column 'mc.h1' in 'where clause'

Inversely, if the search is:
my $rs1 = $c->model('weight::Mdata')->search($where,$attr,{join
=>'mt'},{prefetch => 'mc'});
The DBIC TRACE shows that the join (and the prefetch) occurs between
mdata and mc, and I get the following error:
[error] DBIx::Class::ResultSet::next(): DBI Exception: DBD::mysql::st
execute failed: Unknown column 'mt.n_C' in 'where clause'

There should be a single attributes hash, so

        my $rs1 = $c->model('weight::Mdata')
          ->search($where,
            { %{$attr},
              prefetch => 'mc',
              join =>  'mt' });

[so the other attributes, the prefetch and the join are all part of a single hash and not 3 different parameters passed to search]

        Nigel.

--
[ Nigel Metheringham ------------------------------ ni...@dotdot.it ]
[                 Ellipsis Intangible Technologies                  ]

_______________________________________________
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/dbix-class@lists.scsys.co.uk

Reply via email to