forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMongoDBSelect.java
More file actions
104 lines (85 loc) · 2.77 KB
/
MongoDBSelect.java
File metadata and controls
104 lines (85 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package sqlancer.mongodb.ast;
import java.util.List;
import sqlancer.common.ast.newast.Node;
import sqlancer.mongodb.test.MongoDBColumnTestReference;
public class MongoDBSelect<E> implements Node<E> {
private final String mainTableName;
private final MongoDBColumnTestReference joinColumn;
List<MongoDBColumnTestReference> projectionColumns;
List<MongoDBColumnTestReference> lookupList;
boolean hasFilter;
Node<E> filterClause;
boolean hasComputed;
List<Node<E>> computedClauses;
private boolean withCountClause;
public MongoDBSelect(String mainTableName, MongoDBColumnTestReference joinColumn) {
this.mainTableName = mainTableName;
this.joinColumn = joinColumn;
}
public String getMainTableName() {
return mainTableName;
}
public MongoDBColumnTestReference getJoinColumn() {
return joinColumn;
}
public void setProjectionList(List<MongoDBColumnTestReference> fetchColumns) {
if (fetchColumns == null || fetchColumns.isEmpty()) {
throw new IllegalArgumentException();
}
this.projectionColumns = fetchColumns;
}
public List<MongoDBColumnTestReference> getProjectionList() {
if (projectionColumns == null) {
throw new IllegalStateException();
}
return projectionColumns;
}
public void setLookupList(List<MongoDBColumnTestReference> lookupList) {
if (lookupList == null || lookupList.isEmpty()) {
throw new IllegalArgumentException();
}
this.lookupList = lookupList;
}
public List<MongoDBColumnTestReference> getLookupList() {
if (lookupList == null) {
throw new IllegalStateException();
}
return lookupList;
}
public void setFilterClause(Node<E> filterClause) {
if (filterClause == null) {
hasFilter = false;
this.filterClause = null;
return;
}
hasFilter = true;
this.filterClause = filterClause;
}
public Node<E> getFilterClause() {
return filterClause;
}
public boolean hasFilter() {
return hasFilter;
}
public void setComputedClause(List<Node<E>> computedClause) {
if (computedClause == null) {
hasComputed = false;
this.computedClauses = null;
return;
}
hasComputed = true;
this.computedClauses = computedClause;
}
public List<Node<E>> getComputedClause() {
return computedClauses;
}
public boolean hasComputed() {
return hasComputed;
}
public boolean getWithCountClause() {
return withCountClause;
}
public void setWithCountClause(boolean withCountClause) {
this.withCountClause = withCountClause;
}
}