[Dbix-class] Second join gets eaten in _merge_attr

luke saunders luke.saunders at gmail.com
Mon Oct 29 19:44:15 GMT 2007


my bad. fixed in trunk:
http://dev.catalystframework.org/svnweb/bast/revision/?rev=3844

thanks for the test.

On 10/29/07, Zbigniew Lukasiak <zzbbyy at gmail.com> wrote:
> When you have a resultset that has a join in it and you try to do a
> search on it with another join to the same table twice then the second
> join is joined only once.
>
> # t/90join_torture.t
>
> my $rs = $schema->resultset("Artist")->search({}, { join => 'twokeys' });
> my $second_search_rs = $rs->search({ 'cds_2.cdid' => '2' }, { join =>
> ['cds', 'cds'] });
> is(scalar(@{$second_search_rs->{attrs}->{join}}), 3, 'both joins kept');
> ok($second_search_rs->next, 'query on double joined rel runs okay');
>
>
> __OUTPUT__
>
> #   Failed test 'both joins kept'
> #   at t/90join_torture.t line 125.
> #          got: '2'
> #     expected: '3'
> DBIx::Class::ResultSet::next(): DBI Exception: DBD::SQLite::db
> prepare_cached failed: no such column: cds_2.cdid(1) at dbdimp.c line
> 271 [for Statement "SELECT me.artistid, me.name FROM artist me LEFT
> JOIN twokeys twokeys ON ( twokeys.artist = me.artistid ) LEFT JOIN cd
> cds ON ( cds.artist = me.artistid ) WHERE ( cds_2.cdid = ? )"] at
> t/90join_torture.t line 126
>
>
>
> The svn diff is attached (it's against
> http://dev.catalyst.perl.org/repos/bast/DBIx-Class/0.08/trunk/lib I
> hope that's the right branch).
>
> --
> Zbigniew Lukasiak
> http://brudnopis.blogspot.com/
>
> _______________________________________________
> 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.rawmode.org
>
>



More information about the DBIx-Class mailing list