}\r
}\r
\r
+ @Override\r
+ public boolean supportsSavePoints() {\r
+ return true;\r
+ }\r
+\r
/**\r
* Allows subclasses to change the type of a column for a CREATE statement.\r
*\r
return o.toString();\r
}\r
\r
- @SuppressWarnings("incomplete-switch")\r
- @Override\r
- public void prepareCreateConstraintForeignKey(SQLStatement stat, String schemaName, String tableName, ConstraintForeignKeyDefinition constraint) {\r
- StatementBuilder buff = new StatementBuilder();\r
- buff.append("ALTER TABLE ");\r
- buff.append(prepareTableName(schemaName, tableName));\r
- buff.append(" ADD CONSTRAINT ");\r
- buff.append(constraint.constraintName);\r
- buff.append(" FOREIGN KEY ");\r
- buff.append(" (");\r
- for (String col : constraint.foreignColumns) {\r
- buff.appendExceptFirst(", ");\r
- buff.append(prepareColumnName(col));\r
- }\r
- buff.append(") ");\r
- buff.append(" REFERENCES ");\r
- buff.append(constraint.referenceTable);\r
- buff.append(" (");\r
- buff.resetCount();\r
- for (String col : constraint.referenceColumns) {\r
- buff.appendExceptFirst(", ");\r
- buff.append(prepareColumnName(col));\r
- }\r
- buff.append(") ");\r
- if (constraint.deleteType != ConstraintDeleteType.UNSET) {\r
- buff.append(" ON DELETE ");\r
- switch (constraint.deleteType) {\r
- case CASCADE:\r
- buff.append("CASCADE ");\r
- break;\r
- case RESTRICT:\r
- buff.append("RESTRICT ");\r
- break;\r
- case SET_NULL:\r
- buff.append("SET NULL ");\r
- break;\r
- case NO_ACTION:\r
- buff.append("NO ACTION ");\r
- break;\r
- case SET_DEFAULT:\r
- buff.append("SET DEFAULT ");\r
- break;\r
- }\r
- }\r
- if (constraint.updateType != ConstraintUpdateType.UNSET) {\r
- buff.append(" ON UPDATE ");\r
- switch (constraint.updateType) {\r
- case CASCADE:\r
- buff.append("CASCADE ");\r
- break;\r
- case RESTRICT:\r
- buff.append("RESTRICT ");\r
- break;\r
- case SET_NULL:\r
- buff.append("SET NULL ");\r
- break;\r
- case NO_ACTION:\r
- buff.append("NO ACTION ");\r
- break;\r
- case SET_DEFAULT:\r
- buff.append("SET DEFAULT ");\r
- break;\r
- }\r
- }\r
- switch (constraint.deferrabilityType) {\r
- case DEFERRABLE_INITIALLY_DEFERRED:\r
- buff.append("DEFERRABLE INITIALLY DEFERRED ");\r
- break;\r
- case DEFERRABLE_INITIALLY_IMMEDIATE:\r
- buff.append("DEFERRABLE INITIALLY IMMEDIATE ");\r
- break;\r
- case NOT_DEFERRABLE:\r
- buff.append("NOT DEFERRABLE ");\r
- break;\r
- case UNSET:\r
- break;\r
- }\r
- stat.setSQL(buff.toString().trim());\r
- }\r
-\r
- @Override\r
- public void prepareCreateConstraintUnique(SQLStatement stat, String schemaName, String tableName, ConstraintUniqueDefinition constraint) {\r
- StatementBuilder buff = new StatementBuilder();\r
- buff.append("ALTER TABLE ");\r
- buff.append(prepareTableName(schemaName, tableName));\r
- buff.append(" ADD CONSTRAINT ");\r
- buff.append(constraint.constraintName);\r
- buff.append(" UNIQUE ");\r
- buff.append(" (");\r
- for (String col : constraint.uniqueColumns) {\r
- buff.appendExceptFirst(", ");\r
- buff.append(prepareColumnName(col));\r
- }\r
- buff.append(") ");\r
- stat.setSQL(buff.toString().trim());\r
- }\r
-\r
}
\ No newline at end of file