OPENJA-1070:support for composite foreign keys on MySQL Version >= 5

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@772828 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2009-05-08 01:31:37 +00:00
parent 9a8246799c
commit da17643624
2 changed files with 4 additions and 7 deletions

View File

@ -181,6 +181,7 @@ public class DBDictionary
public int maxIndexNameLength = 128;
public int maxIndexesPerTable = Integer.MAX_VALUE;
public boolean supportsForeignKeys = true;
public boolean supportsForeignKeysComposite = true;
public boolean supportsUniqueConstraints = true;
public boolean supportsDeferredConstraints = true;
public boolean supportsRestrictDeleteAction = true;
@ -3381,6 +3382,8 @@ public class DBDictionary
protected String getForeignKeyConstraintSQL(ForeignKey fk) {
if (!supportsForeignKeys)
return null;
if (fk.getColumns().length > 0 && !supportsForeignKeysComposite)
return null;
if (fk.getDeleteAction() == ForeignKey.ACTION_NONE)
return null;
if (fk.isDeferred() && !supportsDeferredForeignKeyConstraints())

View File

@ -141,6 +141,7 @@ public class MySQLDictionary
if (maj < 4 || (maj == 4 && min < 1)) {
supportsSubselect = false;
allowsAliasInBulkClause = false;
supportsForeignKeysComposite = false;
}
if (maj > 5 || (maj == 5 && min >= 1))
supportsXMLColumn = true;
@ -217,13 +218,6 @@ public class MySQLDictionary
return ret;
}
protected String getForeignKeyConstraintSQL(ForeignKey fk) {
// mysql does not support composite foreign keys
if (fk.getColumns().length > 1)
return null;
return super.getForeignKeyConstraintSQL(fk);
}
public String[] getDeleteTableContentsSQL(Table[] tables) {
// mysql >= 4 supports more-optimal delete syntax
if (!optimizeMultiTableDeletes)