OPENJPA-282. No test case.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@570579 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Patrick Linskey 2007-08-28 21:48:53 +00:00
parent ba7de16762
commit e959466d1d
2 changed files with 29 additions and 4 deletions

View File

@ -3038,7 +3038,7 @@ public class DBDictionary
return null;
if (fk.getDeleteAction() == ForeignKey.ACTION_NONE)
return null;
if (fk.isDeferred() && !supportsDeferredConstraints)
if (fk.isDeferred() && !supportsDeferredForeignKeyConstraints())
return null;
if (!supportsDeleteAction(fk.getDeleteAction())
|| !supportsUpdateAction(fk.getUpdateAction()))
@ -3075,7 +3075,7 @@ public class DBDictionary
buf.append(" ON UPDATE ").append(upAction);
if (fk.isDeferred())
buf.append(" INITIALLY DEFERRED");
if (supportsDeferredConstraints)
if (supportsDeferredForeignKeyConstraints())
buf.append(" DEFERRABLE");
if (fk.getName() != null
&& CONS_NAME_AFTER.equals(constraintNameMode))
@ -3083,6 +3083,16 @@ public class DBDictionary
return buf.toString();
}
/**
* Whether or not this dictionary supports deferred foreign key constraints.
* This implementation returns {@link #supportsUniqueConstraints}.
*
* @since 1.1.0
*/
protected boolean supportsDeferredForeignKeyConstraints() {
return supportsUniqueConstraints;
}
/**
* Return the name of the given foreign key action.
*/
@ -3151,7 +3161,7 @@ public class DBDictionary
*/
protected String getUniqueConstraintSQL(Unique unq) {
if (!supportsUniqueConstraints
|| (unq.isDeferred() && !supportsDeferredConstraints))
|| (unq.isDeferred() && !supportsDeferredUniqueConstraints()))
return null;
StringBuffer buf = new StringBuffer();
@ -3165,7 +3175,7 @@ public class DBDictionary
append(")");
if (unq.isDeferred())
buf.append(" INITIALLY DEFERRED");
if (supportsDeferredConstraints)
if (supportsDeferredUniqueConstraints())
buf.append(" DEFERRABLE");
if (unq.getName() != null
&& CONS_NAME_AFTER.equals(constraintNameMode))
@ -3173,6 +3183,16 @@ public class DBDictionary
return buf.toString();
}
/**
* Whether or not this dictionary supports deferred unique constraints.
* This implementation returns {@link #supportsUniqueConstraints}.
*
* @since 1.1.0
*/
protected boolean supportsDeferredUniqueConstraints() {
return supportsUniqueConstraints;
}
/////////////////////
// Database metadata
/////////////////////

View File

@ -271,6 +271,11 @@ public class PostgresDictionary
return sql;
}
protected boolean supportsDeferredUniqueConstraints() {
// Postgres only supports deferred foreign key constraints.
return false;
}
protected String getSequencesSQL(String schemaName, String sequenceName) {
if (schemaName == null && sequenceName == null)
return allSequencesSQL;