]> source.dussan.org Git - jackcess.git/commitdiff
Applied Jon Iles' patch to allow large table definitions to be read.
authorTim McCune <javajedi@users.sf.net>
Fri, 3 Feb 2006 23:55:47 +0000 (23:55 +0000)
committerTim McCune <javajedi@users.sf.net>
Fri, 3 Feb 2006 23:55:47 +0000 (23:55 +0000)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@32 f203690c-595d-4dc9-a70b-905162fa7fd2

CREDITS.txt
src/java/com/healthmarketscience/jackcess/Table.java

index f78ece81225bb0218a14607348dd8e9dc256f796..b6c6a68843c595e01c1295911cc008447003cd3d 100644 (file)
@@ -1,3 +1,5 @@
 Tim McCune - Original author and project founder
 Rob DiMarco - Added ability to import delimited text into new tables
 Mitchell J. Friedman - Added support for additional JDBC data types
+James Ahlborn - Added support for NUMERIC data type
+Jon Iles - Added support for reading table definitions that span multiple pages
index b0223b63d9665aac917e7f1bb773e1c272b35061..a9a6944cf6a2d80de5415389bba8bf9ce05c2f9c 100644 (file)
@@ -29,6 +29,7 @@ package com.healthmarketscience.jackcess;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -107,10 +108,22 @@ public class Table {
     _format = format;
     _tableDefPageNumber = pageNumber;
     int nextPage;
-    do {
-      readPage();
-      nextPage = _buffer.getInt(_format.OFFSET_NEXT_TABLE_DEF_PAGE);
-    } while (nextPage > 0);
+               ByteBuffer nextPageBuffer = null;
+               nextPage = _buffer.getInt(_format.OFFSET_NEXT_TABLE_DEF_PAGE);
+               while (nextPage != 0) {
+                       if (nextPageBuffer == null) {
+                               nextPageBuffer = ByteBuffer.allocate(format.PAGE_SIZE);
+                               nextPageBuffer.order(ByteOrder.LITTLE_ENDIAN);
+                       }
+                       _pageChannel.readPage(nextPageBuffer, nextPage);
+                       nextPage = nextPageBuffer.getInt(_format.OFFSET_NEXT_TABLE_DEF_PAGE);
+                       ByteBuffer newBuffer = ByteBuffer.allocate(_buffer.capacity() + format.PAGE_SIZE - 8);
+                       newBuffer.order(ByteOrder.LITTLE_ENDIAN);
+                       newBuffer.put(_buffer);
+                       newBuffer.put(nextPageBuffer.array(), 8, format.PAGE_SIZE - 8);
+                       _buffer = newBuffer;
+               }
+               readPage();     
   }
   
   /**