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 @@ -3043,11 +3043,21 @@ Select SetOperationList(Select select) #SetOperationList: {
3043
3043
[ <K_ALL> { union.setAll(true); } | <K_DISTINCT> { union.setDistinct(true); } ]
3044
3044
)
3045
3045
|
3046
- <K_INTERSECT> { operations.add(new IntersectOp()); }
3046
+ (
3047
+ <K_INTERSECT> { IntersectOp intersect = new IntersectOp(); linkAST(intersect,jjtThis); operations.add(intersect); }
3048
+ [ <K_ALL> { intersect.setAll(true); } | <K_DISTINCT> { intersect.setDistinct(true); } ]
3049
+ )
3047
3050
|
3048
- <K_MINUS> { operations.add(new MinusOp()); }
3051
+ (
3052
+ <K_MINUS> { MinusOp minus = new MinusOp(); linkAST(minus,jjtThis); operations.add(minus); }
3053
+ [ <K_ALL> { minus.setAll(true); } | <K_DISTINCT> { minus.setDistinct(true); } ]
3054
+ )
3049
3055
|
3050
- <K_EXCEPT> { operations.add(new ExceptOp()); }
3056
+ (
3057
+ <K_EXCEPT> { ExceptOp except = new ExceptOp(); linkAST(except,jjtThis); operations.add(except); }
3058
+ [ <K_ALL> { except.setAll(true); } | <K_DISTINCT> { except.setDistinct(true); } ]
3059
+ )
3060
+
3051
3061
)
3052
3062
3053
3063
(
You can’t perform that action at this time.
0 commit comments