summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2009-12-23 02:41:00 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2009-12-23 02:41:00 +0000
commit350e547443e2619337e3a8339e8fbbc334ec5d81 (patch)
tree4bf22a143fbf811b8ab7bceea187966204092e61
parentd590fa696b5dd00c73d659a4b0d2c4f7a0c87886 (diff)
downloadjackcess-350e547443e2619337e3a8339e8fbbc334ec5d81.tar.gz
jackcess-350e547443e2619337e3a8339e8fbbc334ec5d81.zip
Set overflow info in header row, not in last data row. (fixes #2919216)
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@424 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r--src/changes/changes.xml5
-rw-r--r--src/java/com/healthmarketscience/jackcess/Table.java41
2 files changed, 27 insertions, 19 deletions
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a9ba17b..59d4c35 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -9,7 +9,7 @@
Further improvements to date handling.
</action>
<action dev="jahlborn" type="update">
- Handler more binary/character input types (Blob, Clob, InputStream,
+ Handle more binary/character input types (Blob, Clob, InputStream,
Reader), based on user submitted patch.
</action>
<action dev="jahlborn" type="update">
@@ -17,6 +17,9 @@
reuse of existing tables. make behavior/naming of copy and import
methods consistent. (ideas from use submitted patch).
</action>
+ <action dev="jahlborn" type="fix" issue="2919216">
+ Set overflow info in header row, not in last data row.
+ </action>
</release>
<release version="1.1.20" date="2009-11-18">
<action dev="jahlborn" type="fix" issue="2884599">
diff --git a/src/java/com/healthmarketscience/jackcess/Table.java b/src/java/com/healthmarketscience/jackcess/Table.java
index 0eb9f9c..02f1d49 100644
--- a/src/java/com/healthmarketscience/jackcess/Table.java
+++ b/src/java/com/healthmarketscience/jackcess/Table.java
@@ -1353,32 +1353,37 @@ public class Table
PageChannel.INVALID_PAGE_NUMBER);
pageNumber = _addRowBufferH.getPageNumber();
- ByteBuffer oldDataPage = rowState.getFinalPage();
- int oldPageNumber = rowState.getFinalRowId().getPageNumber();
- if(pageNumber == oldPageNumber) {
- // new row is on the same page as current row, share page
- dataPage = oldDataPage;
+ RowId headerRowId = rowState.getHeaderRowId();
+ ByteBuffer headerPage = rowState.getHeaderPage();
+ if(pageNumber == headerRowId.getPageNumber()) {
+ // new row is on the same page as header row, share page
+ dataPage = headerPage;
}
- // write out the new row data (set the deleted flag on the new data row)
+ // write out the new row data (set the deleted flag on the new data row
+ // so that it is ignored during normal table traversal)
int rowNum = addDataPageRow(dataPage, rowSize, getFormat(),
DELETED_ROW_MASK);
- dataPage.put(newRowData);
-
- // write the overflow info into the old row and clear out the remaining
- // old data
+ dataPage.put(newRowData);
+
+ // write the overflow info into the header row and clear out the
+ // remaining header data
+ rowBuffer = PageChannel.narrowBuffer(
+ headerPage,
+ findRowStart(headerPage, headerRowId.getRowNumber(), getFormat()),
+ findRowEnd(headerPage, headerRowId.getRowNumber(), getFormat()));
rowBuffer.put((byte)rowNum);
ByteUtil.put3ByteInt(rowBuffer, pageNumber);
ByteUtil.clearRemaining(rowBuffer);
- // set the overflow flag on the old row
- int oldRowNumber = rowState.getFinalRowId().getRowNumber();
- int oldRowIndex = getRowStartOffset(oldRowNumber, getFormat());
- oldDataPage.putShort(oldRowIndex,
- (short)(oldDataPage.getShort(oldRowIndex)
- | OVERFLOW_ROW_MASK));
- if(pageNumber != oldPageNumber) {
- writeDataPage(oldDataPage, oldPageNumber);
+ // set the overflow flag on the header row
+ int headerRowIndex = getRowStartOffset(headerRowId.getRowNumber(),
+ getFormat());
+ headerPage.putShort(headerRowIndex,
+ (short)(headerPage.getShort(headerRowIndex)
+ | OVERFLOW_ROW_MASK));
+ if(pageNumber != headerRowId.getPageNumber()) {
+ writeDataPage(headerPage, headerRowId.getPageNumber());
}
}