-
Notifications
You must be signed in to change notification settings - Fork 397
Expand file tree
/
Copy pathMySQLSelect.java
More file actions
73 lines (57 loc) · 1.86 KB
/
MySQLSelect.java
File metadata and controls
73 lines (57 loc) · 1.86 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
package sqlancer.mysql.ast;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import sqlancer.common.ast.SelectBase;
import sqlancer.common.ast.newast.Select;
import sqlancer.mysql.MySQLSchema.MySQLColumn;
import sqlancer.mysql.MySQLSchema.MySQLTable;
import sqlancer.mysql.MySQLVisitor;
public class MySQLSelect extends SelectBase<MySQLExpression>
implements MySQLExpression, Select<MySQLJoin, MySQLExpression, MySQLTable, MySQLColumn> {
private SelectType fromOptions = SelectType.ALL;
private List<String> modifiers = Collections.emptyList();
private MySQLText hint;
public enum SelectType {
DISTINCT, ALL, DISTINCTROW;
}
public void setSelectType(SelectType fromOptions) {
this.setFromOptions(fromOptions);
}
public SelectType getFromOptions() {
return fromOptions;
}
public void setFromOptions(SelectType fromOptions) {
this.fromOptions = fromOptions;
}
public void setModifiers(List<String> modifiers) {
this.modifiers = modifiers;
}
public List<String> getModifiers() {
return modifiers;
}
@Override
public MySQLConstant getExpectedValue() {
return null;
}
public void setHint(MySQLText hint) {
this.hint = hint;
}
public MySQLText getHint() {
return hint;
}
@Override
public void setJoinClauses(List<MySQLJoin> joinStatements) {
List<MySQLExpression> expressions = joinStatements.stream().map(e -> (MySQLExpression) e)
.collect(Collectors.toList());
setJoinList(expressions);
}
@Override
public List<MySQLJoin> getJoinClauses() {
return getJoinList().stream().map(e -> (MySQLJoin) e).collect(Collectors.toList());
}
@Override
public String asString() {
return MySQLVisitor.asString(this);
}
}