File tree Expand file tree Collapse file tree 4 files changed +22
-4
lines changed
main/java/net/sf/jsqlparser
test/java/net/sf/jsqlparser/test/select Expand file tree Collapse file tree 4 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 2525
2626public class AllComparisonExpression implements Expression {
2727
28- private SubSelect subSelect ;
28+ private final SubSelect subSelect ;
2929
3030 public AllComparisonExpression (SubSelect subSelect ) {
3131 this .subSelect = subSelect ;
@@ -39,4 +39,9 @@ public SubSelect getSubSelect() {
3939 public void accept (ExpressionVisitor expressionVisitor ) {
4040 expressionVisitor .visit (this );
4141 }
42+
43+ @ Override
44+ public String toString () {
45+ return "ALL " + subSelect .toString ();
46+ }
4247}
Original file line number Diff line number Diff line change 2525
2626public class AnyComparisonExpression implements Expression {
2727
28- private SubSelect subSelect ;
28+ private final SubSelect subSelect ;
2929
3030 public AnyComparisonExpression (SubSelect subSelect ) {
3131 this .subSelect = subSelect ;
@@ -39,4 +39,9 @@ public SubSelect getSubSelect() {
3939 public void accept (ExpressionVisitor expressionVisitor ) {
4040 expressionVisitor .visit (this );
4141 }
42+
43+ @ Override
44+ public String toString () {
45+ return "ANY " + subSelect .toString ();
46+ }
4247}
Original file line number Diff line number Diff line change @@ -416,13 +416,13 @@ public void visit(WhenClause whenClause) {
416416
417417 @ Override
418418 public void visit (AllComparisonExpression allComparisonExpression ) {
419- buffer .append (" ALL " );
419+ buffer .append ("ALL " );
420420 allComparisonExpression .getSubSelect ().accept ((ExpressionVisitor ) this );
421421 }
422422
423423 @ Override
424424 public void visit (AnyComparisonExpression anyComparisonExpression ) {
425- buffer .append (" ANY " );
425+ buffer .append ("ANY " );
426426 anyComparisonExpression .getSubSelect ().accept ((ExpressionVisitor ) this );
427427 }
428428
Original file line number Diff line number Diff line change @@ -1682,6 +1682,14 @@ public void testSelectJoin() throws JSQLParserException {
16821682 public void testSelectJoin2 () throws JSQLParserException {
16831683 assertSqlCanBeParsedAndDeparsed ("SELECT * FROM pg_constraint WHERE pg_attribute.attnum = ANY(pg_constraint.conkey)" );
16841684 }
1685+
1686+ public void testAnyConditionSubSelect () throws JSQLParserException {
1687+ assertSqlCanBeParsedAndDeparsed ("SELECT e1.empno, e1.sal FROM emp e1 WHERE e1.sal > ANY (SELECT e2.sal FROM emp e2 WHERE e2.deptno = 10)" );
1688+ }
1689+
1690+ public void testAllConditionSubSelect () throws JSQLParserException {
1691+ assertSqlCanBeParsedAndDeparsed ("SELECT e1.empno, e1.sal FROM emp e1 WHERE e1.sal > ALL (SELECT e2.sal FROM emp e2 WHERE e2.deptno = 10)" );
1692+ }
16851693
16861694 public void testSelectOracleColl () throws JSQLParserException {
16871695 assertSqlCanBeParsedAndDeparsed ("SELECT * FROM the_table tt WHERE TT.COL1 = lines(idx).COL1" );
You can’t perform that action at this time.
0 commit comments