]> source.dussan.org Git - jackcess.git/commitdiff
clear nextPageNumber for held dataPage
authorJames Ahlborn <jtahlborn@yahoo.com>
Thu, 3 Apr 2008 02:56:44 +0000 (02:56 +0000)
committerJames Ahlborn <jtahlborn@yahoo.com>
Thu, 3 Apr 2008 02:56:44 +0000 (02:56 +0000)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@307 f203690c-595d-4dc9-a70b-905162fa7fd2

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

index 80fa91701d25a1f76fa2f9dcabd4c81d749b5c94..fea96e836cfe8d4beb9ce9a87a4d7f31e2a1d89a 100644 (file)
@@ -93,15 +93,18 @@ public class SimpleIndex extends Index {
 
     // save the first leaf page
     _dataPage = indexPage;
+    nextPageNumber = indexPage.getNextPageNumber();
+    _dataPage.setNextPageNumber(INVALID_INDEX_PAGE_NUMBER);
+    indexPage = null;
     
     // read all leaf pages.
-    while(indexPage.getNextPageNumber() != INVALID_INDEX_PAGE_NUMBER) {
+    while(nextPageNumber != INVALID_INDEX_PAGE_NUMBER) {
         
       // FIXME we can't modify this index at this point in time
       setReadOnly();
         
       // found another one
-      indexPage = new SimpleDataPage(indexPage.getNextPageNumber());
+      indexPage = new SimpleDataPage(nextPageNumber);
       readDataPage(indexPage);
 
       // since we read all the entries in sort order, we can insert them
@@ -110,6 +113,7 @@ public class SimpleIndex extends Index {
       int totalSize = (_dataPage.getTotalEntrySize() +
                        indexPage.getTotalEntrySize());
       _dataPage.setTotalEntrySize(totalSize);
+      nextPageNumber = indexPage.getNextPageNumber();
     }
 
     // check the entry order, just to be safe