blob: e0a5035d7104398548a5011ded01949aa06af802 (
plain)
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
|
package com.iciql.dialect;
import com.iciql.TableDefinition.IndexDefinition;
import com.iciql.util.StatementBuilder;
/**
* H2 database dialect.
*/
public class H2Dialect extends DefaultSQLDialect {
@Override
public boolean supportsMemoryTables() {
return true;
}
@Override
public boolean supportsMerge() {
return true;
}
@Override
public String prepareCreateIndex(String schema, String table, IndexDefinition index) {
StatementBuilder buff = new StatementBuilder();
buff.append("CREATE ");
switch (index.type) {
case STANDARD:
break;
case UNIQUE:
buff.append("UNIQUE ");
break;
case HASH:
buff.append("HASH ");
break;
case UNIQUE_HASH:
buff.append("UNIQUE HASH ");
break;
}
buff.append("INDEX IF NOT EXISTS ");
buff.append(index.indexName);
buff.append(" ON ");
buff.append(table);
buff.append("(");
for (String col : index.columnNames) {
buff.appendExceptFirst(", ");
buff.append(col);
}
buff.append(")");
return buff.toString();
}
}
|