- print "OR\n";
- # if left child is a NOT, we need an extra (inner) join
- # unless right child is also a NOT
- if(($left && $left->name() && $left->name() eq "NOT") &&
- !($right && $right->name() && $right->name() eq "NOT"))
- {
- push(@joins, "INNER");
- push(@outjoins, "INNER");
- }
+ # if the rightmost part of the left sub-expression ends in
+ # NOT, then we need an extra join. This doesn't apply if
+ # (as above) the righthand expression is a NOT.
+ $join="INNER" if(($self->right_ends_in_not($left)) &&
+ !($right && $right->name() && $right->name() eq "NOT"));
+ }
+ if($join)
+ {
+ push(@joins, $join);
+ push(@outjoins, $join);