forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClickHouseCommon.java
More file actions
38 lines (29 loc) · 1.05 KB
/
ClickHouseCommon.java
File metadata and controls
38 lines (29 loc) · 1.05 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
package sqlancer.clickhouse.gen;
import java.util.ArrayList;
import java.util.List;
import sqlancer.clickhouse.ClickHouseSchema;
import sqlancer.clickhouse.ast.ClickHouseExpression;
import sqlancer.clickhouse.ast.ClickHouseTableReference;
public final class ClickHouseCommon {
private ClickHouseCommon() {
}
public static String createColumnName(int nr) {
return String.format("c%d", nr);
}
public static String createTableName(int nr) {
return String.format("t%d", nr);
}
public static String createConstraintName(int nr) {
return String.format("x%d", nr);
}
public static List<ClickHouseExpression> getTableRefs(List<ClickHouseSchema.ClickHouseTable> tables,
ClickHouseSchema s) {
List<ClickHouseExpression> tableRefs = new ArrayList<>();
for (ClickHouseSchema.ClickHouseTable t : tables) {
ClickHouseTableReference tableRef;
tableRef = new ClickHouseTableReference(t, null);
tableRefs.add(tableRef);
}
return tableRefs;
}
}