+ my ($rightstr, @rightjoins) = $right->to_sql($hasvals, $not, @joins) if($right);
+ push(@outjoins, @rightjoins);
+ $str = $leftstr;
+ $str .= " $op " if($op && !$not);
+ $str .= $rightstr;
+ $str=("(" . $str . ")") if($op && $left && $right);
+# print "LEFT (", scalar(@$leftjoins), "): ";
+# print $leftstr if $leftstr;
+# print "\n";
+# print "OP: $op\n" if $op;
+# print "RIGHT (", scalar(@$rightjoins), "): ";
+# print $rightstr if $rightstr;
+# print "\n";
+ print "OUT(", scalar(@outjoins), "): $str\n";
+ return($str, @outjoins);