George Hartzell wrote:
> George Hartzell writes:
>  > [...]
>  > Holy Mackerel:
>  > 
>  >   my $rs = $s->resultset('...')->search({
>  >                                           'node_count(me.id)' => 2,
>  >                                           'control_count(me.id)' => 1,
>  >                                           'attrs.name' => 'NodeType',
>  >                                           'attrs.value' => 'Protein',
>  >                                           'attrs_2.name' => 'Organism',
>  >                                           'attrs_2.value' => 'Homo 
> sapiens',
>  >                                           'attrs_3.name' => 'NodeType',
>  >                                           'attrs_3.value' => 'Protein',
>  >                                           'attrs_4.name' => 'Organism',
>  >                                           'attrs_4.value' => 'Homo 
> sapiens',
>  >                                           'rncbts.value' => 'Protein',
>  >                                           'rncbts.count' => 2,
>  >                                          },
>  >                                          {
>  >                                           join => [{nodes =>
>  >                                                     ['attrs', 'attrs']},
>  >                                                    {nodes =>
>  >                                                     ['attrs', 'attrs']},
>  >                                                    'rncbts',
>  >                                                   ]
>  >                                          },
>  >                                         );
>  > 
>  > 
>  > which says that attrs and attrs_2 belong_to one node, and attrs_3 and
>  > attrs_4 belong to the other.
>  > 
>  > wow.  yeesh.
>  > [...]
>
> As it stands above, it finds <rn>'s that have two nodes, but it
> happily just uses one of them to meet the constraints on attrs/attrs_1
> then uses the same node to satisfy the constraints on attrs_3/attrs_4.
>
> I need nodes and nodes_2 to be different. e.g. my hand coded sql said
> something like nodes.id != nodes_2.id.
>
> I'm not sure where to express that conststraint.
>   
Stick

'nodes.id' => \"!= nodes_2.id"

on the end of your WHERE clause hashref

_______________________________________________
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