my($self, $hasvals, $not, @joins)=@_;
$not=0 unless(defined($not));
my @outjoins=();
- my $str='';
- # init
unless(@joins)
{
@outjoins = @joins = ("INNER");
}
+ my $str='';
if($self->type() != $TYPE_BOOL)
{
- my $cnt=scalar(@joins)+1;
$str .= "t" . scalar(@joins) . ".id='" . $self->{id} . "'";
if($not && !$hasvals)
{
- $str .= " AND fxt" . scalar(@joins) . ".files_id IS NULL";
+ $str = "(" . $str . " AND fxt" . scalar(@joins) . ".files_id IS NULL)";
}
return ($str, @outjoins);
}
$str=$leftstr;
$str .= " $op " if($op && !$not);
$str .= $rightstr;
- if($op || ($left && $right))
+ if($op && $left && $right)
{
$str="(" . $str . ")";
}