]> source.dussan.org Git - jackcess.git/commitdiff
Fix simple index handling of tail index pages (2043499)
authorJames Ahlborn <jtahlborn@yahoo.com>
Thu, 11 Sep 2008 03:42:05 +0000 (03:42 +0000)
committerJames Ahlborn <jtahlborn@yahoo.com>
Thu, 11 Sep 2008 03:42:05 +0000 (03:42 +0000)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@373 f203690c-595d-4dc9-a70b-905162fa7fd2

src/changes/changes.xml
src/java/com/healthmarketscience/jackcess/SimpleIndex.java

index 1d7342f49be85c1653a5a0cdc105413bd4c20d2f..3acf98540ad448c0bbd5f55444bc485f69fda638 100644 (file)
@@ -5,6 +5,11 @@
     <author email="jahlborn@users.sf.net">James Ahlborn</author>
   </properties>
   <body>
+    <release version="1.1.17" date="TBD">
+      <action dev="jahlborn" type="fix" issue="2043499">
+        Fix simple index handling of tail index pages.
+      </action>
+    </release>
     <release version="1.1.16" date="2008-07-24">
       <action dev="jahlborn" type="fix" issue="2019244">
         Reserve minimum space for memo/ole fields so that greedy inline row
index 35ef662c76f0391b5e9c3a6ea45e01f09ff6aa7c..60117e5e7b02e24d5bba3dcc91c28220cadb8921 100644 (file)
@@ -68,7 +68,12 @@ public class SimpleIndex extends Index {
         setReadOnly();
 
         // found another node page
-        nextPageNumber = indexPage.getEntries().get(0).getSubPageNumber();
+        if(!indexPage.getEntries().isEmpty()) {
+          nextPageNumber = indexPage.getEntries().get(0).getSubPageNumber();
+        } else {
+          // try tail page
+          nextPageNumber = indexPage.getChildTailPageNumber();
+        }
         indexPage = null;
       } else {
         // found first leaf
@@ -136,6 +141,7 @@ public class SimpleIndex extends Index {
     private boolean _leaf;
     private int _nextPageNumber;
     private int _totalEntrySize;
+    private int _childTailPageNumber;
     private List<Entry> _entries;
 
     private SimpleDataPage(int pageNumber) {
@@ -171,10 +177,12 @@ public class SimpleIndex extends Index {
       _nextPageNumber = pageNumber;
     }
     @Override
-    public int getChildTailPageNumber() { return 0; }
+    public int getChildTailPageNumber() { 
+      return _childTailPageNumber;
+    }
     @Override
     public void setChildTailPageNumber(int pageNumber) {
-      // ignored
+      _childTailPageNumber = pageNumber;
     }
     
     @Override