forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelectBase.java
More file actions
129 lines (103 loc) · 3.15 KB
/
SelectBase.java
File metadata and controls
129 lines (103 loc) · 3.15 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package sqlancer.common.ast;
import java.util.Collections;
import java.util.List;
public class SelectBase<T> {
List<T> fetchColumns;
List<T> groupByExpressions = Collections.emptyList();
List<T> orderByExpressions = Collections.emptyList();
List<T> joinList = Collections.emptyList();
List<T> fromList;
T whereClause;
T havingClause;
T limitClause;
T offsetClause;
public void setFetchColumns(List<T> fetchColumns) {
if (fetchColumns == null || fetchColumns.isEmpty()) {
throw new IllegalArgumentException();
}
this.fetchColumns = fetchColumns;
}
public List<T> getFetchColumns() {
if (fetchColumns == null) {
throw new IllegalStateException();
}
return fetchColumns;
}
public void setFromList(List<T> fromList) {
if (fromList == null /* || fromList.size() == 0 TODO: refactor the CockroachDB implementation */) {
throw new IllegalArgumentException();
}
this.fromList = fromList;
}
public void setFromTables(List<T> tables) {
setFromList(tables);
}
public List<T> getFromList() {
if (fromList == null) {
throw new IllegalStateException();
}
return fromList;
}
public void setGroupByExpressions(List<T> groupByExpressions) {
if (groupByExpressions == null) {
throw new IllegalArgumentException();
}
this.groupByExpressions = groupByExpressions;
}
public void clearGroupByExpressions() {
this.groupByExpressions = Collections.emptyList();
}
public List<T> getGroupByExpressions() {
assert groupByExpressions != null;
return groupByExpressions;
}
public void setOrderByClauses(List<T> orderByExpressions) {
if (orderByExpressions == null) {
throw new IllegalArgumentException();
}
this.orderByExpressions = orderByExpressions;
}
public List<T> getOrderByClauses() {
assert orderByExpressions != null;
return orderByExpressions;
}
public void setWhereClause(T whereClause) {
this.whereClause = whereClause;
}
public T getWhereClause() {
return whereClause;
}
public void setHavingClause(T havingClause) {
this.havingClause = havingClause;
}
public T getHavingClause() {
return havingClause;
}
public void clearHavingClause() {
this.havingClause = null;
}
public void setLimitClause(T limitClause) {
this.limitClause = limitClause;
}
public T getLimitClause() {
return limitClause;
}
public void setOffsetClause(T offsetClause) {
this.offsetClause = offsetClause;
}
public T getOffsetClause() {
return offsetClause;
}
public List<T> getJoinList() {
return joinList;
}
public void setJoinList(List<T> joinList) {
this.joinList = joinList;
}
public List<T> getGroupByClause() {
return getGroupByExpressions();
}
public void setGroupByClause(List<T> groupByExpressions) {
setGroupByExpressions(groupByExpressions);
}
}