/
StateToReproduce.java
152 lines (103 loc) · 3.77 KB
/
StateToReproduce.java
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
141
142
143
144
145
146
147
148
149
150
151
152
package sqlancer;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import sqlancer.clickhouse.ClickHouseSchema;
import sqlancer.clickhouse.ast.ClickHouseConstant;
import sqlancer.clickhouse.ast.ClickHouseExpression;
import sqlancer.mysql.MySQLSchema.MySQLColumn;
import sqlancer.mysql.ast.MySQLConstant;
import sqlancer.mysql.ast.MySQLExpression;
import sqlancer.postgres.PostgresSchema.PostgresColumn;
import sqlancer.postgres.ast.PostgresConstant;
import sqlancer.postgres.ast.PostgresExpression;
import sqlancer.sqlite3.ast.SQLite3Constant;
import sqlancer.sqlite3.ast.SQLite3Expression;
import sqlancer.sqlite3.schema.SQLite3Schema.SQLite3Column;
public class StateToReproduce {
public final List<Query> statements = new ArrayList<>();
public String queryString;
private final String databaseName;
public String databaseVersion;
protected long seedValue;
public String values;
String exception;
public String queryTargetedTablesString;
public String queryTargetedColumnsString;
public StateToReproduce(String databaseName) {
this.databaseName = databaseName;
}
public String getException() {
return exception;
}
public String getDatabaseName() {
return databaseName;
}
public String getDatabaseVersion() {
return databaseVersion;
}
public List<Query> getStatements() {
return statements;
}
public String getQueryString() {
return queryString;
}
public long getSeedValue() {
return seedValue;
}
public static class MySQLStateToReproduce extends StateToReproduce {
public Map<MySQLColumn, MySQLConstant> randomRowValues;
public MySQLExpression whereClause;
public String queryThatSelectsRow;
public MySQLStateToReproduce(String databaseName) {
super(databaseName);
}
public Map<MySQLColumn, MySQLConstant> getRandomRowValues() {
return randomRowValues;
}
public MySQLExpression getWhereClause() {
return whereClause;
}
}
public static class SQLite3StateToReproduce extends StateToReproduce {
public Map<SQLite3Column, SQLite3Constant> randomRowValues;
public SQLite3Expression whereClause;
public SQLite3StateToReproduce(String databaseName) {
super(databaseName);
}
public Map<SQLite3Column, SQLite3Constant> getRandomRowValues() {
return randomRowValues;
}
public SQLite3Expression getWhereClause() {
return whereClause;
}
}
public static class PostgresStateToReproduce extends StateToReproduce {
public Map<PostgresColumn, PostgresConstant> randomRowValues;
public PostgresExpression whereClause;
public String queryThatSelectsRow;
public PostgresStateToReproduce(String databaseName) {
super(databaseName);
}
public Map<PostgresColumn, PostgresConstant> getRandomRowValues() {
return randomRowValues;
}
public PostgresExpression getWhereClause() {
return whereClause;
}
}
public static class ClickHouseStateToReproduce extends StateToReproduce {
public Map<ClickHouseSchema.ClickHouseColumn, ClickHouseConstant> randomRowValues;
public ClickHouseExpression whereClause;
public String queryThatSelectsRow;
public ClickHouseStateToReproduce(String databaseName) {
super(databaseName);
}
public Map<ClickHouseSchema.ClickHouseColumn, ClickHouseConstant> getRandomRowValues() {
return randomRowValues;
}
public ClickHouseExpression getWhereClause() {
return whereClause;
}
}
}