From 9c01616c3c14a0536c0cfaae734850f7e6980999 Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Fri, 2 Sep 2016 02:02:59 +0000 Subject: ignore different flags for different fk indexes git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/branches/mutateops@1021 f203690c-595d-4dc9-a70b-905162fa7fd2 --- .../jackcess/impl/RelationshipCreator.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') 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) { -- cgit v1.2.3