forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPostgresOptions.java
More file actions
65 lines (53 loc) · 2.18 KB
/
PostgresOptions.java
File metadata and controls
65 lines (53 loc) · 2.18 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
package sqlancer.postgres;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import sqlancer.CompositeTestOracle;
import sqlancer.MainOptions.DBMSConverter;
import sqlancer.TestOracle;
import sqlancer.postgres.oracle.PostgresNoRECOracle;
import sqlancer.postgres.oracle.PostgresPivotedQuerySynthesisOracle;
import sqlancer.postgres.oracle.tlp.PostgresTLPAggregateOracle;
import sqlancer.postgres.oracle.tlp.PostgresTLPHavingOracle;
import sqlancer.postgres.oracle.tlp.PostgresTLPWhereOracle;
@Parameters
public class PostgresOptions {
@Parameter(names = "--bulk-insert")
public boolean allowBulkInsert = false;
@Parameter(names = "--oracle", converter = DBMSConverter.class)
public List<PostgresOracle> oracle = Arrays.asList(PostgresOracle.QUERY_PARTITIONING);
public enum PostgresOracle {
NOREC {
@Override
public TestOracle create(PostgresGlobalState globalState) throws SQLException {
return new PostgresNoRECOracle(globalState);
}
},
PQS {
@Override
public TestOracle create(PostgresGlobalState globalState) throws SQLException {
return new PostgresPivotedQuerySynthesisOracle(globalState);
}
},
HAVING {
@Override
public TestOracle create(PostgresGlobalState globalState) throws SQLException {
return new PostgresTLPHavingOracle(globalState);
}
},
QUERY_PARTITIONING {
@Override
public TestOracle create(PostgresGlobalState globalState) throws SQLException {
List<TestOracle> oracles = new ArrayList<>();
oracles.add(new PostgresTLPWhereOracle(globalState));
oracles.add(new PostgresTLPHavingOracle(globalState));
oracles.add(new PostgresTLPAggregateOracle(globalState));
return new CompositeTestOracle(oracles);
}
};
public abstract TestOracle create(PostgresGlobalState globalState) throws SQLException;
}
}