summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2008-06-21 05:15:40 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2008-06-21 05:15:40 +0000
commit0ec5b19a9fd4f96981ab73b494e0c867cee9c52c (patch)
tree0939955c3adbaa2d44876d9755661f8a8318d40e
parent0a3627650709d07bdbeeaa444ba12baaab52a9ae (diff)
downloadjackcess-0ec5b19a9fd4f96981ab73b494e0c867cee9c52c.tar.gz
jackcess-0ec5b19a9fd4f96981ab73b494e0c867cee9c52c.zip
Fix writing of large memo/ole fields. Apparently Access does not like
long value fields longer than 4076 bytes. git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@352 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r--src/changes/changes.xml6
-rw-r--r--src/java/com/healthmarketscience/jackcess/Column.java6
-rw-r--r--src/java/com/healthmarketscience/jackcess/JetFormat.java5
3 files changed, 13 insertions, 4 deletions
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index bff2c96..7f3d746 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -5,6 +5,12 @@
<author email="jahlborn@users.sf.net">James Ahlborn</author>
</properties>
<body>
+ <release version="1.1.15" date="TBD">
+ <action dev="jahlborn" type="fix" issue="1998225">
+ Fix writing of large memo/ole fields. Apparently Access does not like
+ long value fields longer than 4076 bytes.
+ </action>
+ </release>
<release version="1.1.14" date="2008-04-29">
<action dev="jahlborn" type="fix" issue="1924705">
Need to store auto-number values back into row so that indexes can be
diff --git a/src/java/com/healthmarketscience/jackcess/Column.java b/src/java/com/healthmarketscience/jackcess/Column.java
index dde0985..5987ae3 100644
--- a/src/java/com/healthmarketscience/jackcess/Column.java
+++ b/src/java/com/healthmarketscience/jackcess/Column.java
@@ -754,9 +754,7 @@ public class Column implements Comparable<Column> {
&& (value.length <= getFormat().MAX_INLINE_LONG_VALUE_SIZE)) {
type = LONG_VALUE_TYPE_THIS_PAGE;
lvalDefLen += value.length;
- } else if(Table.getRowSpaceUsage(value.length, getFormat()) <=
- getFormat().MAX_ROW_SIZE)
- {
+ } else if(value.length <= getFormat().MAX_LONG_VALUE_ROW_SIZE) {
type = LONG_VALUE_TYPE_OTHER_PAGE;
} else {
type = LONG_VALUE_TYPE_OTHER_PAGES;
@@ -802,7 +800,7 @@ public class Column implements Comparable<Column> {
writeLongValueHeader(lvalPage);
// figure out how much we will put in this page
- int chunkLength = Math.min(getFormat().MAX_ROW_SIZE - 4,
+ int chunkLength = Math.min(getFormat().MAX_LONG_VALUE_ROW_SIZE - 4,
remainingLen);
nextLvalPageNum = ((chunkLength < remainingLen) ?
getPageChannel().allocateNewPage() : 0);
diff --git a/src/java/com/healthmarketscience/jackcess/JetFormat.java b/src/java/com/healthmarketscience/jackcess/JetFormat.java
index b8b7fea..0b2b994 100644
--- a/src/java/com/healthmarketscience/jackcess/JetFormat.java
+++ b/src/java/com/healthmarketscience/jackcess/JetFormat.java
@@ -115,6 +115,7 @@ public abstract class JetFormat {
public final int SIZE_ROW_LOCATION;
public final int SIZE_LONG_VALUE_DEF;
public final int MAX_INLINE_LONG_VALUE_SIZE;
+ public final int MAX_LONG_VALUE_ROW_SIZE;
public final int SIZE_TDEF_HEADER;
public final int SIZE_TDEF_TRAILER;
public final int SIZE_COLUMN_DEF_BLOCK;
@@ -200,6 +201,7 @@ public abstract class JetFormat {
SIZE_ROW_LOCATION = defineSizeRowLocation();
SIZE_LONG_VALUE_DEF = defineSizeLongValueDef();
MAX_INLINE_LONG_VALUE_SIZE = defineMaxInlineLongValueSize();
+ MAX_LONG_VALUE_ROW_SIZE = defineMaxLongValueRowSize();
SIZE_TDEF_HEADER = defineSizeTdefHeader();
SIZE_TDEF_TRAILER = defineSizeTdefTrailer();
SIZE_COLUMN_DEF_BLOCK = defineSizeColumnDefBlock();
@@ -264,6 +266,7 @@ public abstract class JetFormat {
protected abstract int defineSizeRowLocation();
protected abstract int defineSizeLongValueDef();
protected abstract int defineMaxInlineLongValueSize();
+ protected abstract int defineMaxLongValueRowSize();
protected abstract int defineSizeTdefHeader();
protected abstract int defineSizeTdefTrailer();
protected abstract int defineSizeColumnDefBlock();
@@ -385,6 +388,8 @@ public abstract class JetFormat {
@Override
protected int defineMaxInlineLongValueSize() { return 64; }
@Override
+ protected int defineMaxLongValueRowSize() { return 4076; }
+ @Override
protected int defineSizeTdefHeader() { return 63; }
@Override
protected int defineSizeTdefTrailer() { return 2; }