]> source.dussan.org Git - jackcess.git/commitdiff
better handling of read-only indexes
authorJames Ahlborn <jtahlborn@yahoo.com>
Sat, 16 Apr 2011 13:45:32 +0000 (13:45 +0000)
committerJames Ahlborn <jtahlborn@yahoo.com>
Sat, 16 Apr 2011 13:45:32 +0000 (13:45 +0000)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@552 f203690c-595d-4dc9-a70b-905162fa7fd2

src/java/com/healthmarketscience/jackcess/Database.java
src/java/com/healthmarketscience/jackcess/IndexCursor.java
src/java/com/healthmarketscience/jackcess/IndexData.java

index 9156a461b2706e5e5903a9a59de1e56ab41eeb53..3691e22a55d9b84a8e39588e0ec674e7871b96d9 100644 (file)
@@ -2003,9 +2003,6 @@ public class Database
 
     private DefaultTableFinder(IndexCursor systemCatalogCursor) {
       _systemCatalogCursor = systemCatalogCursor;
-      if(_systemCatalogCursor.getIndex().getIndexData().isReadOnly()) {
-        throw new IllegalArgumentException("Unusable index");
-      }
     }
 
     @Override
index df31a098bb8f8c28511f0c02a98c6ce782217a32..2529c4009554c997164272c283769b41369f2742 100644 (file)
@@ -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));
index 87e23a78ad39ea7c5ececd689b64ad481a948090..93f4ad58b471f5fa34e976f83cd3399e670deb26 100644 (file)
@@ -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);
     }