summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2008-06-24 00:01:25 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2008-06-24 00:01:25 +0000
commitf6d431d8d283c603e70c8ffac40f687718a4490c (patch)
tree43b773524575a19a487c4ac8b6394862a5d69c90
parent0ec5b19a9fd4f96981ab73b494e0c867cee9c52c (diff)
downloadjackcess-f6d431d8d283c603e70c8ffac40f687718a4490c.tar.gz
jackcess-f6d431d8d283c603e70c8ffac40f687718a4490c.zip
Reduce maximum row size to what Access considers valid.
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@353 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r--src/changes/changes.xml3
-rw-r--r--src/java/com/healthmarketscience/jackcess/JetFormat.java7
-rw-r--r--src/java/com/healthmarketscience/jackcess/Table.java6
3 files changed, 11 insertions, 5 deletions
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7f3d746..05b2d62 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -10,6 +10,9 @@
Fix writing of large memo/ole fields. Apparently Access does not like
long value fields longer than 4076 bytes.
</action>
+ <action dev="jahlborn" type="fix">
+ Reduce maximum row size to what Access considers valid.
+ </action>
</release>
<release version="1.1.14" date="2008-04-29">
<action dev="jahlborn" type="fix" issue="1924705">
diff --git a/src/java/com/healthmarketscience/jackcess/JetFormat.java b/src/java/com/healthmarketscience/jackcess/JetFormat.java
index 0b2b994..d0900f1 100644
--- a/src/java/com/healthmarketscience/jackcess/JetFormat.java
+++ b/src/java/com/healthmarketscience/jackcess/JetFormat.java
@@ -65,6 +65,7 @@ public abstract class JetFormat {
public final long MAX_DATABASE_SIZE;
public final int MAX_ROW_SIZE;
+ public final int PAGE_INITIAL_FREE_SPACE;
public final int OFFSET_NEXT_TABLE_DEF_PAGE;
public final int OFFSET_NUM_ROWS;
@@ -151,6 +152,7 @@ public abstract class JetFormat {
MAX_DATABASE_SIZE = defineMaxDatabaseSize();
MAX_ROW_SIZE = defineMaxRowSize();
+ PAGE_INITIAL_FREE_SPACE = definePageInitialFreeSpace();
OFFSET_NEXT_TABLE_DEF_PAGE = defineOffsetNextTableDefPage();
OFFSET_NUM_ROWS = defineOffsetNumRows();
@@ -216,6 +218,7 @@ public abstract class JetFormat {
protected abstract long defineMaxDatabaseSize();
protected abstract int defineMaxRowSize();
+ protected abstract int definePageInitialFreeSpace();
protected abstract int defineOffsetNextTableDefPage();
protected abstract int defineOffsetNumRows();
@@ -296,7 +299,9 @@ public abstract class JetFormat {
}
@Override
- protected int defineMaxRowSize() { return PAGE_SIZE - 16; }
+ protected int defineMaxRowSize() { return 4060; }
+ @Override
+ protected int definePageInitialFreeSpace() { return PAGE_SIZE - 14; }
@Override
protected int defineOffsetNextTableDefPage() { return 4; }
diff --git a/src/java/com/healthmarketscience/jackcess/Table.java b/src/java/com/healthmarketscience/jackcess/Table.java
index ad6d9ad..c4976ba 100644
--- a/src/java/com/healthmarketscience/jackcess/Table.java
+++ b/src/java/com/healthmarketscience/jackcess/Table.java
@@ -904,10 +904,9 @@ public class Table
PageChannel pageChannel, JetFormat format)
throws IOException
{
- // USAGE_MAP_DEF_FREE_SPACE = 3940;
int usageMapRowLength = format.OFFSET_USAGE_MAP_START +
format.USAGE_MAP_TABLE_BYTE_LENGTH;
- int freeSpace = getRowSpaceUsage(format.MAX_ROW_SIZE, format)
+ int freeSpace = format.PAGE_INITIAL_FREE_SPACE
- (2 * getRowSpaceUsage(usageMapRowLength, format));
ByteBuffer rtn = pageChannel.createPageBuffer();
@@ -1290,8 +1289,7 @@ public class Table
ByteBuffer dataPage = _addRowBufferH.setNewPage(getPageChannel());
dataPage.put(PageTypes.DATA); //Page type
dataPage.put((byte) 1); //Unknown
- dataPage.putShort((short)getRowSpaceUsage(getFormat().MAX_ROW_SIZE,
- getFormat())); //Free space in this page
+ dataPage.putShort((short)getFormat().PAGE_INITIAL_FREE_SPACE); //Free space in this page
dataPage.putInt(_tableDefPageNumber); //Page pointer to table definition
dataPage.putInt(0); //Unknown
dataPage.putShort((short)0); //Number of rows on this page