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 13
13
14
14
public class ExceptOp extends SetOperation {
15
15
16
- private boolean distinct ;
17
- private boolean all ;
18
-
19
16
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 ("" );
37
18
}
38
19
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 ;
48
23
}
49
24
50
25
public ExceptOp withDistinct (boolean distinct ) {
@@ -56,4 +31,9 @@ public ExceptOp withAll(boolean all) {
56
31
this .setAll (all );
57
32
return this ;
58
33
}
34
+
35
+ public ExceptOp withModifier (String modifier ) {
36
+ this .modifier = modifier ;
37
+ return this ;
38
+ }
59
39
}
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
-
19
16
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 ("" );
32
18
}
33
19
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 ;
47
23
}
48
24
49
25
public IntersectOp withDistinct (boolean distinct ) {
@@ -55,4 +31,9 @@ public IntersectOp withAll(boolean all) {
55
31
this .setAll (all );
56
32
return this ;
57
33
}
34
+
35
+ public IntersectOp withModifier (String modifier ) {
36
+ this .modifier = modifier ;
37
+ return this ;
38
+ }
58
39
}
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
- private boolean distinct ;
16
- private boolean all ;
17
-
18
15
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 ("" );
31
17
}
32
18
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 ;
46
22
}
47
23
48
24
public MinusOp withDistinct (boolean distinct ) {
@@ -54,4 +30,9 @@ public MinusOp withAll(boolean all) {
54
30
this .setAll (all );
55
31
return this ;
56
32
}
33
+
34
+ public MinusOp withModifier (String modifier ) {
35
+ this .modifier = modifier ;
36
+ return this ;
37
+ }
57
38
}
Original file line number Diff line number Diff line change 13
13
import net .sf .jsqlparser .statement .select .SetOperationList .SetOperationType ;
14
14
15
15
public 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
+ }
16
33
17
34
private SetOperationType type ;
18
35
@@ -22,6 +39,6 @@ public SetOperation(SetOperationType type) {
22
39
23
40
@ Override
24
41
public String toString () {
25
- return type .name ();
42
+ return modifier == null || modifier . isEmpty () ? type .name () : type . name () + " " + modifier ;
26
43
}
27
44
}
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 UnionOp extends SetOperation {
15
-
16
- private boolean distinct ;
17
- private boolean all ;
18
-
19
15
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 ("" );
29
17
}
30
18
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 ;
48
22
}
49
23
50
24
public UnionOp withDistinct (boolean distinct ) {
@@ -56,4 +30,9 @@ public UnionOp withAll(boolean all) {
56
30
this .setAll (all );
57
31
return this ;
58
32
}
33
+
34
+ public UnionOp withModifier (String modifier ) {
35
+ this .modifier = modifier ;
36
+ return this ;
37
+ }
59
38
}
You can’t perform that action at this time.
0 commit comments