File tree Expand file tree Collapse file tree 4 files changed +131
-4
lines changed
java/net/sf/jsqlparser/statement/select
jjtree/net/sf/jsqlparser/parser Expand file tree Collapse file tree 4 files changed +131
-4
lines changed Original file line number Diff line number Diff line change 13
13
14
14
public class ExceptOp extends SetOperation {
15
15
16
+ private boolean distinct ;
17
+ private boolean all ;
18
+
16
19
public ExceptOp () {
17
20
super (SetOperationType .EXCEPT );
18
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 ;
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 ;
48
+ }
49
+
50
+ public ExceptOp withDistinct (boolean distinct ) {
51
+ this .setDistinct (distinct );
52
+ return this ;
53
+ }
54
+
55
+ public ExceptOp withAll (boolean all ) {
56
+ this .setAll (all );
57
+ return this ;
58
+ }
19
59
}
Original file line number Diff line number Diff line change 13
13
14
14
public class IntersectOp extends SetOperation {
15
15
16
+ private boolean distinct ;
17
+ private boolean all ;
18
+
16
19
public IntersectOp () {
17
20
super (SetOperationType .INTERSECT );
18
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 ;
32
+ }
33
+
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 ;
47
+ }
48
+
49
+ public IntersectOp withDistinct (boolean distinct ) {
50
+ this .setDistinct (distinct );
51
+ return this ;
52
+ }
53
+
54
+ public IntersectOp withAll (boolean all ) {
55
+ this .setAll (all );
56
+ return this ;
57
+ }
19
58
}
Original file line number Diff line number Diff line change 12
12
import net .sf .jsqlparser .statement .select .SetOperationList .SetOperationType ;
13
13
14
14
public class MinusOp extends SetOperation {
15
-
15
+ private boolean distinct ;
16
+ private boolean all ;
17
+
16
18
public MinusOp () {
17
19
super (SetOperationType .MINUS );
18
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 ;
31
+ }
32
+
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 ;
46
+ }
47
+
48
+ public MinusOp withDistinct (boolean distinct ) {
49
+ this .setDistinct (distinct );
50
+ return this ;
51
+ }
52
+
53
+ public MinusOp withAll (boolean all ) {
54
+ this .setAll (all );
55
+ return this ;
56
+ }
19
57
}
Original file line number Diff line number Diff line change @@ -2612,11 +2612,21 @@ Select SetOperationList(Select select) #SetOperationList: {
2612
2612
[ <K_ALL> { union.setAll(true); } | <K_DISTINCT> { union.setDistinct(true); } ]
2613
2613
)
2614
2614
|
2615
- <K_INTERSECT> { operations.add(new IntersectOp()); }
2615
+ (
2616
+ <K_INTERSECT> { IntersectOp intersect = new IntersectOp(); linkAST(intersect,jjtThis); operations.add(intersect); }
2617
+ [ <K_ALL> { intersect.setAll(true); } | <K_DISTINCT> { intersect.setDistinct(true); } ]
2618
+ )
2616
2619
|
2617
- <K_MINUS> { operations.add(new MinusOp()); }
2620
+ (
2621
+ <K_MINUS> { MinusOp minus = new MinusOp(); linkAST(minus,jjtThis); operations.add(minus); }
2622
+ [ <K_ALL> { minus.setAll(true); } | <K_DISTINCT> { minus.setDistinct(true); } ]
2623
+ )
2618
2624
|
2619
- <K_EXCEPT> { operations.add(new ExceptOp()); }
2625
+ (
2626
+ <K_EXCEPT> { ExceptOp except = new ExceptOp(); linkAST(except,jjtThis); operations.add(except); }
2627
+ [ <K_ALL> { except.setAll(true); } | <K_DISTINCT> { except.setDistinct(true); } ]
2628
+ )
2629
+
2620
2630
)
2621
2631
2622
2632
(
You can’t perform that action at this time.
0 commit comments