aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2008-02-21 21:03:25 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2008-02-21 21:03:25 +0000
commita680b8e33654c3509da88cd5c8383c8cbd184696 (patch)
treede15cbb09b4396a4080ce0d4cae393a38ca9de07
parentf566162860c7ec132cf23018fcc508817cad58ff (diff)
downloadjackcess-a680b8e33654c3509da88cd5c8383c8cbd184696.tar.gz
jackcess-a680b8e33654c3509da88cd5c8383c8cbd184696.zip
do not inline memo/ole fields longer than 64 bytes (fix #1899076)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@230 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r--src/changes/changes.xml4
-rw-r--r--src/java/com/healthmarketscience/jackcess/Column.java3
-rw-r--r--src/java/com/healthmarketscience/jackcess/JetFormat.java5
3 files changed, 11 insertions, 1 deletions
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index f00f27d..6913095 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -9,6 +9,10 @@
<action dev="jahlborn" type="fix">
Resolve more edge cases around date handling.
</action>
+ <action dev="jahlborn" type="fix" issue="1899076">
+ Fix writing of large memo/ole fields. Apparently Access does not like
+ "inline" fields longer than 64 bytes.
+ </action>
</release>
<release version="1.1.11" date="2008-01-20">
<action dev="jahlborn" type="fix">
diff --git a/src/java/com/healthmarketscience/jackcess/Column.java b/src/java/com/healthmarketscience/jackcess/Column.java
index 73fa511..1de4b16 100644
--- a/src/java/com/healthmarketscience/jackcess/Column.java
+++ b/src/java/com/healthmarketscience/jackcess/Column.java
@@ -736,7 +736,8 @@ public class Column implements Comparable<Column> {
// determine which type to write
byte type = 0;
int lvalDefLen = getFormat().SIZE_LONG_VALUE_DEF;
- if((getFormat().SIZE_LONG_VALUE_DEF + value.length) <= remainingRowLength) {
+ if(((getFormat().SIZE_LONG_VALUE_DEF + value.length) <= remainingRowLength)
+ && (value.length <= getFormat().MAX_INLINE_LONG_VALUE_SIZE)) {
type = LONG_VALUE_TYPE_THIS_PAGE;
lvalDefLen += value.length;
} else if(Table.getRowSpaceUsage(value.length, getFormat()) <=
diff --git a/src/java/com/healthmarketscience/jackcess/JetFormat.java b/src/java/com/healthmarketscience/jackcess/JetFormat.java
index 4e7fd69..a9e96da 100644
--- a/src/java/com/healthmarketscience/jackcess/JetFormat.java
+++ b/src/java/com/healthmarketscience/jackcess/JetFormat.java
@@ -113,6 +113,7 @@ public abstract class JetFormat {
public final int SIZE_COLUMN_HEADER;
public final int SIZE_ROW_LOCATION;
public final int SIZE_LONG_VALUE_DEF;
+ public final int MAX_INLINE_LONG_VALUE_SIZE;
public final int SIZE_TDEF_HEADER;
public final int SIZE_TDEF_TRAILER;
public final int SIZE_COLUMN_DEF_BLOCK;
@@ -197,6 +198,7 @@ public abstract class JetFormat {
SIZE_COLUMN_HEADER = defineSizeColumnHeader();
SIZE_ROW_LOCATION = defineSizeRowLocation();
SIZE_LONG_VALUE_DEF = defineSizeLongValueDef();
+ MAX_INLINE_LONG_VALUE_SIZE = defineMaxInlineLongValueSize();
SIZE_TDEF_HEADER = defineSizeTdefHeader();
SIZE_TDEF_TRAILER = defineSizeTdefTrailer();
SIZE_COLUMN_DEF_BLOCK = defineSizeColumnDefBlock();
@@ -259,6 +261,7 @@ public abstract class JetFormat {
protected abstract int defineSizeColumnHeader();
protected abstract int defineSizeRowLocation();
protected abstract int defineSizeLongValueDef();
+ protected abstract int defineMaxInlineLongValueSize();
protected abstract int defineSizeTdefHeader();
protected abstract int defineSizeTdefTrailer();
protected abstract int defineSizeColumnDefBlock();
@@ -376,6 +379,8 @@ public abstract class JetFormat {
@Override
protected int defineSizeLongValueDef() { return 12; }
@Override
+ protected int defineMaxInlineLongValueSize() { return 64; }
+ @Override
protected int defineSizeTdefHeader() { return 63; }
@Override
protected int defineSizeTdefTrailer() { return 2; }