forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOceanBaseDropIndex.java
More file actions
28 lines (23 loc) · 1015 Bytes
/
OceanBaseDropIndex.java
File metadata and controls
28 lines (23 loc) · 1015 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
package sqlancer.oceanbase.gen;
import sqlancer.IgnoreMeException;
import sqlancer.common.query.ExpectedErrors;
import sqlancer.common.query.SQLQueryAdapter;
import sqlancer.oceanbase.OceanBaseGlobalState;
import sqlancer.oceanbase.OceanBaseSchema.OceanBaseTable;
public final class OceanBaseDropIndex {
private OceanBaseDropIndex() {
}
public static SQLQueryAdapter generate(OceanBaseGlobalState globalState) {
OceanBaseTable table = globalState.getSchema().getRandomTable();
if (!table.hasIndexes()) {
throw new IgnoreMeException();
}
StringBuilder sb = new StringBuilder();
sb.append("DROP INDEX ");
sb.append(table.getRandomIndex().getIndexName());
sb.append(" ON ");
sb.append(table.getName());
return new SQLQueryAdapter(sb.toString(), ExpectedErrors.from("LOCK=NONE is not supported",
"ALGORITHM=INPLACE is not supported", "Data truncation", "Data truncated for functional index"));
}
}