-
Notifications
You must be signed in to change notification settings - Fork 397
Expand file tree
/
Copy pathSQLite3Select.java
More file actions
140 lines (109 loc) · 3.85 KB
/
SQLite3Select.java
File metadata and controls
140 lines (109 loc) · 3.85 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
130
131
132
133
134
135
136
137
138
139
140
package sqlancer.sqlite3.ast;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import sqlancer.sqlite3.schema.SQLite3Schema.SQLite3Column.SQLite3CollateSequence;
public class SQLite3Select extends SQLite3Expression {
private SelectType fromOptions = SelectType.ALL;
private List<SQLite3Expression> fromList = Collections.emptyList();
private SQLite3Expression whereClause;
private List<SQLite3Expression> groupByClause = Collections.emptyList();
private SQLite3Expression limitClause;
private List<SQLite3Expression> orderByClause = Collections.emptyList();
private SQLite3Expression offsetClause;
private List<SQLite3Expression> fetchColumns = Collections.emptyList();
private List<Join> joinStatements = Collections.emptyList();
private SQLite3Expression havingClause;
public SQLite3Select() {
}
public SQLite3Select(SQLite3Select other) {
fromOptions = other.fromOptions;
fromList = new ArrayList<>(other.fromList);
whereClause = other.whereClause;
groupByClause = other.groupByClause;
limitClause = other.limitClause;
orderByClause = new ArrayList<>(other.orderByClause);
offsetClause = other.offsetClause;
fetchColumns = new ArrayList<>(fetchColumns);
joinStatements = new ArrayList<>();
for (Join j : other.joinStatements) {
joinStatements.add(new Join(j));
}
havingClause = other.havingClause;
}
public enum SelectType {
DISTINCT, ALL;
}
public void setSelectType(SelectType fromOptions) {
this.setFromOptions(fromOptions);
}
public void setFromTables(List<SQLite3Expression> fromTables) {
this.setFromList(fromTables);
}
public SelectType getFromOptions() {
return fromOptions;
}
public void setFromOptions(SelectType fromOptions) {
this.fromOptions = fromOptions;
}
public List<SQLite3Expression> getFromList() {
return fromList;
}
public void setFromList(List<SQLite3Expression> fromList) {
this.fromList = fromList;
}
public SQLite3Expression getWhereClause() {
return whereClause;
}
public void setWhereClause(SQLite3Expression whereClause) {
this.whereClause = whereClause;
}
public void setGroupByClause(List<SQLite3Expression> groupByClause) {
this.groupByClause = groupByClause;
}
public List<SQLite3Expression> getGroupByClause() {
return groupByClause;
}
public void setLimitClause(SQLite3Expression limitClause) {
this.limitClause = limitClause;
}
public SQLite3Expression getLimitClause() {
return limitClause;
}
public List<SQLite3Expression> getOrderByClause() {
return orderByClause;
}
public void setOrderByExpressions(List<SQLite3Expression> orderBy) {
this.orderByClause = orderBy;
}
public void setOffsetClause(SQLite3Expression offsetClause) {
this.offsetClause = offsetClause;
}
public SQLite3Expression getOffsetClause() {
return offsetClause;
}
public void setFetchColumns(List<SQLite3Expression> fetchColumns) {
this.fetchColumns = fetchColumns;
}
public List<SQLite3Expression> getFetchColumns() {
return fetchColumns;
}
public void setJoinClauses(List<Join> joinStatements) {
this.joinStatements = joinStatements;
}
public List<Join> getJoinClauses() {
return joinStatements;
}
@Override
public SQLite3CollateSequence getExplicitCollateSequence() {
// TODO implement?
return null;
}
public void setHavingClause(SQLite3Expression havingClause) {
this.havingClause = havingClause;
}
public SQLite3Expression getHavingClause() {
assert orderByClause != null;
return havingClause;
}
}