From: James Ahlborn Date: Fri, 3 May 2013 02:37:20 +0000 (+0000) Subject: do not unicode compress strings which are longer than 1024 chars X-Git-Tag: jackcess-1.2.11~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7811de23a2f685efa24839185155152f33653c95;p=jackcess.git do not unicode compress strings which are longer than 1024 chars git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@709 f203690c-595d-4dc9-a70b-905162fa7fd2 --- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index cd9cac9..c780507 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -4,6 +4,11 @@ Tim McCune + + + Do not unicode compress strings which are longer than 1024 chars. + + Add info to the Column to support MEMO columns which are HYPERLINKS. diff --git a/src/java/com/healthmarketscience/jackcess/Column.java b/src/java/com/healthmarketscience/jackcess/Column.java index 57df40e..835acbd 100644 --- a/src/java/com/healthmarketscience/jackcess/Column.java +++ b/src/java/com/healthmarketscience/jackcess/Column.java @@ -1723,7 +1723,8 @@ public class Column implements Comparable { } // may only compress if column type allows it - if(!forceUncompressed && isCompressedUnicode()) { + if(!forceUncompressed && isCompressedUnicode() && + (text.length() <= getFormat().MAX_COMPRESSED_UNICODE_SIZE)) { // for now, only do very simple compression (only compress text which is // all ascii text) diff --git a/src/java/com/healthmarketscience/jackcess/JetFormat.java b/src/java/com/healthmarketscience/jackcess/JetFormat.java index 2a37120..e3a8af8 100644 --- a/src/java/com/healthmarketscience/jackcess/JetFormat.java +++ b/src/java/com/healthmarketscience/jackcess/JetFormat.java @@ -235,6 +235,7 @@ public abstract class JetFormat { 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 MAX_COMPRESSED_UNICODE_SIZE; public final int SIZE_TDEF_HEADER; public final int SIZE_TDEF_TRAILER; public final int SIZE_COLUMN_DEF_BLOCK; @@ -368,6 +369,7 @@ public abstract class JetFormat { SIZE_LONG_VALUE_DEF = defineSizeLongValueDef(); MAX_INLINE_LONG_VALUE_SIZE = defineMaxInlineLongValueSize(); MAX_LONG_VALUE_ROW_SIZE = defineMaxLongValueRowSize(); + MAX_COMPRESSED_UNICODE_SIZE = defineMaxCompressedUnicodeSize(); SIZE_TDEF_HEADER = defineSizeTdefHeader(); SIZE_TDEF_TRAILER = defineSizeTdefTrailer(); SIZE_COLUMN_DEF_BLOCK = defineSizeColumnDefBlock(); @@ -469,6 +471,7 @@ public abstract class JetFormat { protected abstract int defineSizeLongValueDef(); protected abstract int defineMaxInlineLongValueSize(); protected abstract int defineMaxLongValueRowSize(); + protected abstract int defineMaxCompressedUnicodeSize(); protected abstract int defineSizeTdefHeader(); protected abstract int defineSizeTdefTrailer(); protected abstract int defineSizeColumnDefBlock(); @@ -657,6 +660,8 @@ public abstract class JetFormat { @Override protected int defineMaxLongValueRowSize() { return 2032; } @Override + protected int defineMaxCompressedUnicodeSize() { return 1024; } + @Override protected int defineSizeTdefHeader() { return 63; } @Override protected int defineSizeTdefTrailer() { return 2; } @@ -875,6 +880,8 @@ public abstract class JetFormat { @Override protected int defineMaxLongValueRowSize() { return 4076; } @Override + protected int defineMaxCompressedUnicodeSize() { return 1024; } + @Override protected int defineSizeTdefHeader() { return 63; } @Override protected int defineSizeTdefTrailer() { return 2; }