forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonetGlobalState.java
More file actions
70 lines (53 loc) · 1.89 KB
/
Copy pathMonetGlobalState.java
File metadata and controls
70 lines (53 loc) · 1.89 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
package sqlancer.monet;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import sqlancer.Randomly;
import sqlancer.SQLConnection;
import sqlancer.SQLGlobalState;
public class MonetGlobalState extends SQLGlobalState<MonetOptions, MonetSchema> {
public static final char IMMUTABLE = 'i';
public static final char STABLE = 's';
public static final char VOLATILE = 'v';
private boolean functionsGenerated;
private List<String> operators = Collections.emptyList();
private List<String> collates = Collections.emptyList();
private List<String> opClasses = Collections.emptyList();
@Override
public void setConnection(SQLConnection con) {
super.setConnection(con);
this.opClasses = Arrays.asList(new String[] {});
this.operators = Arrays.asList(new String[] { "<", ">", "<=", ">=", "=", "<>", "!", "^", "|", "||", "&", "~",
"+", "-", "/", "%", "*", "<<", ">>", "@" });
this.collates = Arrays.asList(new String[] {});
}
public List<String> getOperators() {
return operators;
}
public String getRandomOperator() {
return Randomly.fromList(operators);
}
public List<String> getCollates() {
return collates;
}
public String getRandomCollate() {
return Randomly.fromList(collates);
}
public List<String> getOpClasses() {
return opClasses;
}
public String getRandomOpclass() {
return Randomly.fromList(opClasses);
}
public boolean isFunctionsGenerated() {
return this.functionsGenerated;
}
public void setFunctionsGenerated(boolean functionsGenerated) {
this.functionsGenerated = functionsGenerated;
}
@Override
public MonetSchema readSchema() throws SQLException {
return MonetSchema.fromConnection(getConnection(), getDatabaseName());
}
}