-
Notifications
You must be signed in to change notification settings - Fork 397
Expand file tree
/
Copy pathVirtualDBQuery.java
More file actions
31 lines (25 loc) · 983 Bytes
/
VirtualDBQuery.java
File metadata and controls
31 lines (25 loc) · 983 Bytes
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
package sqlancer.reducer.VirtualDB;
import sqlancer.GlobalState;
import sqlancer.SQLConnection;
import sqlancer.common.query.SQLQueryAdapter;
import java.sql.SQLException;
public class VirtualDBQuery extends SQLQueryAdapter {
private static final long serialVersionUID = 1L;
public VirtualDBQuery(String query) {
// Since the base class must check the format
// We judge if the statement could affect schema. A bit hacky tho.
super(query, (query.contains("CREATE TABLE") && !query.startsWith("EXPLAIN")));
}
public VirtualDBQuery(String query, boolean couldAffectSchema) {
super(query, couldAffectSchema);
}
@Override
public <G extends GlobalState<?, ?, SQLConnection>> boolean execute(G globalState, String... fills)
throws SQLException {
try {
return globalState.executeStatement(this, fills);
} catch (Exception e) {
throw new SQLException(e);
}
}
}