diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/healthmarketscience/jackcess/impl/RelationshipCreator.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/RelationshipCreator.java b/src/main/java/com/healthmarketscience/jackcess/impl/RelationshipCreator.java index f73acb3..80c8acf 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/RelationshipCreator.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/RelationshipCreator.java @@ -42,8 +42,10 @@ public class RelationshipCreator extends DBMutator // for the purposes of choosing a backing index for a foreign key, there are // certain index flags that can be ignored (we don't care how they are set) - private final static byte IGNORED_INDEX_FLAGS = + private final static byte IGNORED_PRIMARY_INDEX_FLAGS = IndexData.IGNORE_NULLS_INDEX_FLAG | IndexData.REQUIRED_INDEX_FLAG; + private final static byte IGNORED_SECONDARY_INDEX_FLAGS = + IGNORED_PRIMARY_INDEX_FLAGS | IndexData.UNIQUE_INDEX_FLAG; private TableImpl _primaryTable; private TableImpl _secondaryTable; @@ -60,7 +62,6 @@ public class RelationshipCreator extends DBMutator // - enforcing rel integrity can't have dupe cols // FIXME // - what about index name clashes? - // - access crashes deleting rel? (bad idxs)? public RelationshipCreator(DatabaseImpl database) { @@ -119,13 +120,15 @@ public class RelationshipCreator extends DBMutator private void addPrimaryIndex() throws IOException { TableUpdater updater = new TableUpdater(_primaryTable); updater.setForeignKey(createFKReference(true)); - updater.addIndex(createPrimaryIndex(), true, IGNORED_INDEX_FLAGS, (byte)0); + updater.addIndex(createPrimaryIndex(), true, + IGNORED_PRIMARY_INDEX_FLAGS, (byte)0); } private void addSecondaryIndex() throws IOException { TableUpdater updater = new TableUpdater(_secondaryTable); updater.setForeignKey(createFKReference(false)); - updater.addIndex(createSecondaryIndex(), true, IGNORED_INDEX_FLAGS, (byte)0); + updater.addIndex(createSecondaryIndex(), true, + IGNORED_SECONDARY_INDEX_FLAGS, (byte)0); } private IndexImpl.ForeignKeyReference createFKReference(boolean isPrimary) { |