Skip to content

Commit 990f64f

Browse files
committed
Extract a global state class
1 parent 050a0e5 commit 990f64f

2 files changed

Lines changed: 61 additions & 66 deletions

File tree

src/sqlancer/GlobalState.java

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package sqlancer;
2+
3+
import java.sql.Connection;
4+
5+
import sqlancer.Main.StateLogger;
6+
7+
public class GlobalState {
8+
9+
private Connection con;
10+
private Randomly r;
11+
private MainOptions options;
12+
private StateLogger logger;
13+
private StateToReproduce state;
14+
15+
public void setConnection(Connection con) {
16+
this.con = con;
17+
}
18+
19+
public Connection getConnection() {
20+
return con;
21+
}
22+
23+
public void setRandomly(Randomly r) {
24+
this.r = r;
25+
}
26+
27+
public Randomly getRandomly() {
28+
return r;
29+
}
30+
31+
public MainOptions getOptions() {
32+
return options;
33+
}
34+
35+
public void setMainOptions(MainOptions options) {
36+
this.options = options;
37+
}
38+
39+
public void setStateLogger(StateLogger logger) {
40+
this.logger = logger;
41+
}
42+
43+
public StateLogger getLogger() {
44+
return logger;
45+
}
46+
47+
public void setState(StateToReproduce state) {
48+
this.state = state;
49+
}
50+
51+
public StateToReproduce getState() {
52+
return state;
53+
}
54+
55+
}

src/sqlancer/tidb/TiDBProvider.java

Lines changed: 6 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
import java.sql.Statement;
88

99
import sqlancer.DatabaseProvider;
10+
import sqlancer.GlobalState;
1011
import sqlancer.Main.QueryManager;
1112
import sqlancer.Main.StateLogger;
1213
import sqlancer.MainOptions;
1314
import sqlancer.Query;
1415
import sqlancer.QueryAdapter;
16+
import sqlancer.Randomly;
1517
import sqlancer.StateToReproduce;
1618
import sqlancer.StateToReproduce.MySQLStateToReproduce;
1719

@@ -70,72 +72,10 @@ public static enum Action {
7072
// }
7173
}
7274

73-
public static class TiDBGlobalState {
74-
//
75-
// private Connection con;
76-
// private TiDBSchema schema;
77-
// private Randomly r;
78-
// private MainOptions options;
79-
// private StateLogger logger;
80-
// private StateToReproduce state;
81-
// private TiDBOptions TiDBOptions;
82-
//
83-
// public void setConnection(Connection con) {
84-
// this.con = con;
85-
// }
86-
//
87-
// public Connection getConnection() {
88-
// return con;
89-
// }
90-
//
91-
// public void setSchema(TiDBSchema schema) {
92-
// this.schema = schema;
93-
// }
94-
//
95-
// public TiDBSchema getSchema() {
96-
// return schema;
97-
// }
98-
//
99-
// public void setRandomly(Randomly r) {
100-
// this.r = r;
101-
// }
102-
//
103-
// public Randomly getRandomly() {
104-
// return r;
105-
// }
106-
//
107-
// public MainOptions getOptions() {
108-
// return options;
109-
// }
110-
//
111-
// public void setMainOptions(MainOptions options) {
112-
// this.options = options;
113-
// }
114-
//
115-
// public void setStateLogger(StateLogger logger) {
116-
// this.logger = logger;
117-
// }
118-
//
119-
// public StateLogger getLogger() {
120-
// return logger;
121-
// }
122-
//
123-
// public void setState(StateToReproduce state) {
124-
// this.state = state;
125-
// }
126-
//
127-
// public StateToReproduce getState() {
128-
// return state;
129-
// }
130-
//
131-
// public void setTiDBOptions(TiDBOptions TiDBOptions) {
132-
// this.TiDBOptions = TiDBOptions;
133-
// }
134-
//
135-
// public TiDBOptions getTiDBOptions() {
136-
// return TiDBOptions;
137-
// }
138-
//
75+
76+
77+
public static class TiDBGlobalState extends GlobalState {
78+
13979
}
14080

14181
@Override

0 commit comments

Comments
 (0)