瀏覽代碼

Reserve minimum space for memo/ole fields so that greedy inline row usage does not cause spurious write failures for wide tables.

git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@358 f203690c-595d-4dc9-a70b-905162fa7fd2
tags/rel_1_1_16
James Ahlborn 16 年之前
父節點
當前提交
48404ab2d6

+ 6
- 0
src/changes/changes.xml 查看文件

@@ -5,6 +5,12 @@
<author email="jahlborn@users.sf.net">James Ahlborn</author>
</properties>
<body>
<release version="1.1.16" date="TBD">
<action dev="jahlborn" type="fix" issue="2019244">
Reserve minimum space for memo/ole fields so that greedy inline row
usage does not cause spurious write failures for wide tables.
</action>
</release>
<release version="1.1.15" date="2008-06-27">
<action dev="jahlborn" type="fix" issue="1998225">
Fix writing of large memo/ole fields. Apparently Access does not like

+ 11
- 1
src/java/com/healthmarketscience/jackcess/Table.java 查看文件

@@ -1374,7 +1374,17 @@ public class Table
maxRowSize -= buffer.position();
// now, account for trailer space
maxRowSize -= (nullMask.byteSize() + 4 + (_maxVarColumnCount * 2));

// for each non-null long value column we need to reserve a small
// amount of space so that we don't end up running out of row space
// later by being too greedy
for (Column varCol : _varColumns) {
if((varCol.getType().isLongValue()) &&
(rowArray[varCol.getColumnIndex()] != null)) {
maxRowSize -= getFormat().SIZE_LONG_VALUE_DEF;
}
}
//Now write out variable length column data
short[] varColumnOffsets = new short[_maxVarColumnCount];
int varColumnOffsetsIndex = 0;

+ 26
- 0
test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java 查看文件

@@ -380,6 +380,32 @@ public class DatabaseTest extends TestCase {
}

public void testManyMemos() throws Exception {
final int numColumns = 126;
Database db = create();
TableBuilder bigTableBuilder = new TableBuilder("myBigTable");
for (int i = 0; i < numColumns; i++)
{
Column column = new ColumnBuilder("column_" + i, DataType.MEMO)
.toColumn();
bigTableBuilder.addColumn(column);
}
Table bigTable = bigTableBuilder.toTable(db);

for (int j = 999; j < 1010; j++)
{
Object[] rowData = new String[numColumns];
for (int i = 0; i < numColumns; i++)
{
rowData[i] = "v_" + i + ";" + j;
}
bigTable.addRow(rowData);
}
db.close();
}
public void testMissingFile() throws Exception {
File bogusFile = new File("fooby-dooby.mdb");
assertTrue(!bogusFile.exists());

Loading…
取消
儲存