File tree Expand file tree Collapse file tree 8 files changed +107
-132
lines changed
java/net/sf/jsqlparser/statement/select
jjtree/net/sf/jsqlparser/parser
java/net/sf/jsqlparser/statement/select
resources/net/sf/jsqlparser/statement/select/oracle-tests Expand file tree Collapse file tree 8 files changed +107
-132
lines changed Original file line number Diff line number Diff line change 1313
1414public class ExceptOp extends SetOperation {
1515
16- private boolean distinct ;
17- private boolean all ;
18-
1916 public ExceptOp () {
20- super (SetOperationType .EXCEPT );
21- }
22-
23- public boolean isAll () {
24- return all ;
25- }
26-
27- public void setAll (boolean all ) {
28- this .all = all ;
29- }
30-
31- public boolean isDistinct () {
32- return distinct ;
33- }
34-
35- public void setDistinct (boolean distinct ) {
36- this .distinct = distinct ;
17+ this ("" );
3718 }
3819
39- @ Override
40- public String toString () {
41- String allDistinct = "" ;
42- if (isAll ()) {
43- allDistinct = " ALL" ;
44- } else if (isDistinct ()) {
45- allDistinct = " DISTINCT" ;
46- }
47- return super .toString () + allDistinct ;
20+ public ExceptOp (String modifier ) {
21+ super (SetOperationType .EXCEPT );
22+ this .modifier = modifier ;
4823 }
4924
5025 public ExceptOp withDistinct (boolean distinct ) {
@@ -56,4 +31,9 @@ public ExceptOp withAll(boolean all) {
5631 this .setAll (all );
5732 return this ;
5833 }
34+
35+ public ExceptOp withModifier (String modifier ) {
36+ this .modifier = modifier ;
37+ return this ;
38+ }
5939}
Original file line number Diff line number Diff line change 1313
1414public class IntersectOp extends SetOperation {
1515
16- private boolean distinct ;
17- private boolean all ;
18-
1916 public IntersectOp () {
20- super (SetOperationType .INTERSECT );
21- }
22- public boolean isAll () {
23- return all ;
24- }
25-
26- public void setAll (boolean all ) {
27- this .all = all ;
28- }
29-
30- public boolean isDistinct () {
31- return distinct ;
17+ this ("" );
3218 }
3319
34- public void setDistinct (boolean distinct ) {
35- this .distinct = distinct ;
36- }
37-
38- @ Override
39- public String toString () {
40- String allDistinct = "" ;
41- if (isAll ()) {
42- allDistinct = " ALL" ;
43- } else if (isDistinct ()) {
44- allDistinct = " DISTINCT" ;
45- }
46- return super .toString () + allDistinct ;
20+ public IntersectOp (String modifier ) {
21+ super (SetOperationType .INTERSECT );
22+ this .modifier = modifier ;
4723 }
4824
4925 public IntersectOp withDistinct (boolean distinct ) {
@@ -55,4 +31,9 @@ public IntersectOp withAll(boolean all) {
5531 this .setAll (all );
5632 return this ;
5733 }
34+
35+ public IntersectOp withModifier (String modifier ) {
36+ this .modifier = modifier ;
37+ return this ;
38+ }
5839}
Original file line number Diff line number Diff line change 1212import net .sf .jsqlparser .statement .select .SetOperationList .SetOperationType ;
1313
1414public class MinusOp extends SetOperation {
15- private boolean distinct ;
16- private boolean all ;
17-
1815 public MinusOp () {
19- super (SetOperationType .MINUS );
20- }
21- public boolean isAll () {
22- return all ;
23- }
24-
25- public void setAll (boolean all ) {
26- this .all = all ;
27- }
28-
29- public boolean isDistinct () {
30- return distinct ;
16+ this ("" );
3117 }
3218
33- public void setDistinct (boolean distinct ) {
34- this .distinct = distinct ;
35- }
36-
37- @ Override
38- public String toString () {
39- String allDistinct = "" ;
40- if (isAll ()) {
41- allDistinct = " ALL" ;
42- } else if (isDistinct ()) {
43- allDistinct = " DISTINCT" ;
44- }
45- return super .toString () + allDistinct ;
19+ public MinusOp (String modifier ) {
20+ super (SetOperationType .MINUS );
21+ this .modifier = modifier ;
4622 }
4723
4824 public MinusOp withDistinct (boolean distinct ) {
@@ -54,4 +30,9 @@ public MinusOp withAll(boolean all) {
5430 this .setAll (all );
5531 return this ;
5632 }
33+
34+ public MinusOp withModifier (String modifier ) {
35+ this .modifier = modifier ;
36+ return this ;
37+ }
5738}
Original file line number Diff line number Diff line change 1313import net .sf .jsqlparser .statement .select .SetOperationList .SetOperationType ;
1414
1515public abstract class SetOperation extends ASTNodeAccessImpl {
16+ String modifier = "" ;
17+
18+ public boolean isAll () {
19+ return modifier .contains ("ALL" );
20+ }
21+
22+ public void setAll (boolean all ) {
23+ this .modifier = "ALL" ;
24+ }
25+
26+ public boolean isDistinct () {
27+ return modifier .contains ("DISTINCT" );
28+ }
29+
30+ public void setDistinct (boolean distinct ) {
31+ this .modifier = "DISTINCT" ;
32+ }
1633
1734 private SetOperationType type ;
1835
@@ -22,6 +39,6 @@ public SetOperation(SetOperationType type) {
2239
2340 @ Override
2441 public String toString () {
25- return type .name ();
42+ return modifier == null || modifier . isEmpty () ? type .name () : type . name () + " " + modifier ;
2643 }
2744}
Original file line number Diff line number Diff line change 1212import net .sf .jsqlparser .statement .select .SetOperationList .SetOperationType ;
1313
1414public class UnionOp extends SetOperation {
15-
16- private boolean distinct ;
17- private boolean all ;
18-
1915 public UnionOp () {
20- super (SetOperationType .UNION );
21- }
22-
23- public boolean isAll () {
24- return all ;
25- }
26-
27- public void setAll (boolean all ) {
28- this .all = all ;
16+ this ("" );
2917 }
3018
31- public boolean isDistinct () {
32- return distinct ;
33- }
34-
35- public void setDistinct (boolean distinct ) {
36- this .distinct = distinct ;
37- }
38-
39- @ Override
40- public String toString () {
41- String allDistinct = "" ;
42- if (isAll ()) {
43- allDistinct = " ALL" ;
44- } else if (isDistinct ()) {
45- allDistinct = " DISTINCT" ;
46- }
47- return super .toString () + allDistinct ;
19+ public UnionOp (String modifier ) {
20+ super (SetOperationType .UNION );
21+ this .modifier = modifier ;
4822 }
4923
5024 public UnionOp withDistinct (boolean distinct ) {
@@ -56,4 +30,9 @@ public UnionOp withAll(boolean all) {
5630 this .setAll (all );
5731 return this ;
5832 }
33+
34+ public UnionOp withModifier (String modifier ) {
35+ this .modifier = modifier ;
36+ return this ;
37+ }
5938}
You can’t perform that action at this time.
0 commit comments