On Tue, 26 Dec 2006, Matt LeBlanc wrote:

On 12/26/06, Jess Robinson <[EMAIL PROTECTED]> wrote:
 $schema->resultset('boards')->search({
    'hiddenboards.userId' => 3,
    'me.active' => 1,
 }, {
    'join' => 'hiddenboards',
    '+select' => [ 'hiddenboards.userId' ],
    '+as' => [ 'hidden' ],
    'order_by' => [ 'pos' ],
 })


 .. and set up the relationship between board and hiddenboards to use an
 inner join, not a left join.

 I've not seen the syntax "SELECT .. hiddenboards.userId IS NOT NULL as
 hidden" .. it's odd, why not use the proper join type?

 Jess

... this isn't the same thing. He does not want all of the hidden
boards, as your change to an inner join would return. He wants all
boards with an extra field that tells him whether or not the board is
hidden (if the left join doesn't work, hiddenboards.boardId is null
and as such hidden is false).


Oh! That makes a lot more sense.. OTOH the JOIN .. ON .. hiddenboards.userId = 3 surely negates that effect?

Jess


_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to