forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVirtualDBQuery.java
More file actions
30 lines (24 loc) · 930 Bytes
/
VirtualDBQuery.java
File metadata and controls
30 lines (24 loc) · 930 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
package sqlancer.reducer.VirtualDB;
import sqlancer.GlobalState;
import sqlancer.SQLConnection;
import sqlancer.common.query.SQLQueryAdapter;
import java.sql.SQLException;
public class VirtualDBQuery extends SQLQueryAdapter {
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);
}
}
}