diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2016-09-02 02:02:59 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2016-09-02 02:02:59 +0000 |
commit | 9c01616c3c14a0536c0cfaae734850f7e6980999 (patch) | |
tree | 1224c32d97029fd82bc90583dd44811d024ce845 /src/main/java | |
parent | 399e865d292b55932ae0ba92b89e0a0bb4e34131 (diff) | |
download | jackcess-9c01616c3c14a0536c0cfaae734850f7e6980999.tar.gz jackcess-9c01616c3c14a0536c0cfaae734850f7e6980999.zip |
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
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) { |