aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/healthmarketscience
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2011-04-16 13:45:32 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2011-04-16 13:45:32 +0000
commit955c6654b77ed12de7ee126fad60ee9f294dd8b5 (patch)
tree0e2a79d1058a744fabcd06a43b9930deb40abf9e /src/java/com/healthmarketscience
parent09a9f3809227e3e883571c978865a228db6d6e63 (diff)
downloadjackcess-955c6654b77ed12de7ee126fad60ee9f294dd8b5.tar.gz
jackcess-955c6654b77ed12de7ee126fad60ee9f294dd8b5.zip
better handling of read-only indexes
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@552 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/java/com/healthmarketscience')
-rw-r--r--src/java/com/healthmarketscience/jackcess/Database.java3
-rw-r--r--src/java/com/healthmarketscience/jackcess/IndexCursor.java5
-rw-r--r--src/java/com/healthmarketscience/jackcess/IndexData.java4
3 files changed, 9 insertions, 3 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/Database.java b/src/java/com/healthmarketscience/jackcess/Database.java
index 9156a46..3691e22 100644
--- a/src/java/com/healthmarketscience/jackcess/Database.java
+++ b/src/java/com/healthmarketscience/jackcess/Database.java
@@ -2003,9 +2003,6 @@ public class Database
private DefaultTableFinder(IndexCursor systemCatalogCursor) {
_systemCatalogCursor = systemCatalogCursor;
- if(_systemCatalogCursor.getIndex().getIndexData().isReadOnly()) {
- throw new IllegalArgumentException("Unusable index");
- }
}
@Override
diff --git a/src/java/com/healthmarketscience/jackcess/IndexCursor.java b/src/java/com/healthmarketscience/jackcess/IndexCursor.java
index df31a09..2529c40 100644
--- a/src/java/com/healthmarketscience/jackcess/IndexCursor.java
+++ b/src/java/com/healthmarketscience/jackcess/IndexCursor.java
@@ -137,6 +137,11 @@ public class IndexCursor extends Cursor
"JetFormat " + table.getFormat() +
" does not currently support index lookups");
}
+ if(index.getIndexData().isReadOnly()) {
+ throw new IllegalArgumentException(
+ "Given index " + index +
+ " is not usable for indexed lookups because it is read-only");
+ }
IndexCursor cursor = new IndexCursor(table, index,
index.cursor(startRow, startInclusive,
endRow, endInclusive));
diff --git a/src/java/com/healthmarketscience/jackcess/IndexData.java b/src/java/com/healthmarketscience/jackcess/IndexData.java
index 87e23a7..93f4ad5 100644
--- a/src/java/com/healthmarketscience/jackcess/IndexData.java
+++ b/src/java/com/healthmarketscience/jackcess/IndexData.java
@@ -1191,6 +1191,8 @@ public abstract class IndexData {
return new GenTextColumnDescriptor(col, flags);
}
// unsupported sort order
+ LOG.warn("Unsupported collating sort order " + sortOrder +
+ " for text index, making read-only");
setReadOnly();
return new ReadOnlyColumnDescriptor(col, flags);
case INT:
@@ -1214,6 +1216,8 @@ public abstract class IndexData {
default:
// FIXME we can't modify this index at this point in time
+ LOG.warn("Unsupported data type " + col.getType() +
+ " for index, making read-only");
setReadOnly();
return new ReadOnlyColumnDescriptor(col, flags);
}