01: /*
02: * Created by IntelliJ IDEA.
03: * User: sg426575
04: * Date: May 8, 2006
05: * Time: 2:53:15 AM
06: */
07: package com.technoetic.xplanner.upgrade.schema;
08:
09: /** @noinspection RefusedBequest*/
10: public class MySqlDBDialect extends DBDialect {
11: public String getVendor() {
12: return "MySQL";
13: }
14:
15: public String getCreateTableQuery(String table, String fieldSQL) {
16: return super .getCreateTableQuery(table, fieldSQL)
17: + " type=InnoDB";
18: }
19:
20: public String getAddForeignKeyConstraintQuery(String table,
21: String constraintName, String foreignKey,
22: String referencedTable, String referencedKey) {
23: return "alter table " + table + " add constraint "
24: + constraintName + " foreign key " + constraintName
25: + " (" + foreignKey + ")" + " references "
26: + referencedTable + " (" + referencedKey + ")";
27: }
28:
29: public String getDropForeignKeyConstraintQuery(String table,
30: String constraintName) {
31: return "alter table " + table + " drop foreign key "
32: + constraintName;
33: }
34:
35: public String getAddUniqueConstraintQuery(String table,
36: String constraintName, String column) {
37: return "alter table " + table + " add constraint "
38: + constraintName + " unique " + constraintName + " ( "
39: + column + " )";
40: }
41:
42: public String getDropUniqueConstraintQuery(String table,
43: String constraintName) {
44: return "alter table " + table + " drop index " + constraintName;
45: }
46:
47: }
|