- if(defined($op))
- {
- # if we are ANDing add an inner join
- if($op eq "AND")
- {
- # if right child is a NOT, we don't need extra join/brackets
- # NOT will do the same and we will end up with an extra one
-# unless($right && $right->name() && $right->name() eq "NOT")
-# {
- push(@joins, "INNER");
- push(@outjoins, "INNER");
-# }
- }
- elsif($op eq "NOT")
- {
- $not=1;
- # return an extra join, but don't pass it down to $right->to_sql
- # if we are looking for a tag *value*, use INNER join rather than LEFT
- push(@outjoins, ($hasvals ? "INNER" : "LEFT"));
- }
- }
- my ($rightstr, @rightjoins) = $right->to_sql($hasvals, $not, @joins) if($right);
- push(@outjoins, @rightjoins);
+ $not=1 if(defined($op) && ($op eq "NOT"));
+ my $rightstr = $right->to_sql($hasvals, $not) if($right);