summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2008-03-17 15:31:26 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2008-03-17 15:31:26 +0000
commit8f8d0c0756b4f483ddf1022743387c65d0769d1d (patch)
tree4335ab07ecd418784fd53c1559079d228b675d46
parent446e80d6960d05712272684d9c0ca40066317324 (diff)
downloadjackcess-8f8d0c0756b4f483ddf1022743387c65d0769d1d.tar.gz
jackcess-8f8d0c0756b4f483ddf1022743387c65d0769d1d.zip
add some notes on unique indexes
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@279 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r--src/java/com/healthmarketscience/jackcess/Index.java21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/Index.java b/src/java/com/healthmarketscience/jackcess/Index.java
index d0431db..d52db99 100644
--- a/src/java/com/healthmarketscience/jackcess/Index.java
+++ b/src/java/com/healthmarketscience/jackcess/Index.java
@@ -233,10 +233,25 @@ public class Index implements Comparable<Index> {
return _indexType == FOREIGN_KEY_INDEX_TYPE;
}
+ /**
+ * Whether or not {@code null} values are actually recorded in the index.
+ */
public boolean shouldIgnoreNulls() {
return((_indexFlags & IGNORE_NULLS_INDEX_FLAG) != 0);
}
-
+
+ /**
+ * Whether or not index entries must be unique.
+ * <p>
+ * Some notes about uniqueness:
+ * <ul>
+ * <li>Access does not seem to consider multiple {@code null} entries
+ * invalid for a unique index</li>
+ * <li>text indexes collapse case, and Access seems to compare <b>only</b>
+ * the index entry bytes, therefore two strings which differ only in
+ * case <i>will violate</i> the unique constraint</li>
+ * </ul>
+ */
public boolean isUnique() {
return(isPrimaryKey() || ((_indexFlags & UNIQUE_INDEX_FLAG) != 0));
}
@@ -694,8 +709,8 @@ public class Index implements Comparable<Index> {
idx = missingIndexToInsertionPoint(idx);
// determine if the addition of this entry would break the uniqueness
- // constraint (note, access does not seem to consider multiple null
- // entries invalid for a "unique" index)
+ // constraint. See isUnique() for some notes about uniqueness as
+ // defined by Access.
if(isUnique() && !isNullEntry &&
(((idx > 0) &&
newEntry.equalsEntryBytes(_entries.get(idx - 1))) ||