diff options
author | Tim McCune <javajedi@users.sf.net> | 2005-08-12 05:28:37 +0000 |
---|---|---|
committer | Tim McCune <javajedi@users.sf.net> | 2005-08-12 05:28:37 +0000 |
commit | cd4c2188725dec869749adb490ef24bebc720813 (patch) | |
tree | 23d6a2f3fc28fc007e3235df79370f28d3eab803 /src | |
parent | 468b7748b3df1870bd477d5e46b2f310859534b6 (diff) | |
download | jackcess-cd4c2188725dec869749adb490ef24bebc720813.tar.gz jackcess-cd4c2188725dec869749adb490ef24bebc720813.zip |
Added handling of deleted rows.
Fixed a couple bugs introduced by the 1.5 upgrade.
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@19 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src')
-rw-r--r-- | src/java/com/healthmarketscience/jackcess/Table.java | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/Table.java b/src/java/com/healthmarketscience/jackcess/Table.java index 4714eb1..f9f7f1f 100644 --- a/src/java/com/healthmarketscience/jackcess/Table.java +++ b/src/java/com/healthmarketscience/jackcess/Table.java @@ -202,9 +202,9 @@ public class Table { if (column.getType() == DataType.BOOLEAN) { value = new Boolean(!isNull); //Boolean values are stored in the null mask } else if (!isNull) { - if (!column.getType().isVariableLength()) { + if (!column.isVariableLength()) { //Read in fixed length column data - columnData = new byte[column.getType().getSize()]; + columnData = new byte[column.size()]; _buffer.get(columnData); } else { //Refer to already-read-in variable length data @@ -238,13 +238,18 @@ public class Table { } _rowStart = _buffer.getShort(_format.OFFSET_DATA_ROW_LOCATION_BLOCK + _currentRowInPage * _format.SIZE_ROW_LOCATION); - // XXX - Handle overflow pages and deleted rows. - _buffer.position(_rowStart); - _buffer.limit(_lastRowStart); - _rowsLeftOnPage--; _currentRowInPage++; - _lastRowStart = _rowStart; - return true; + _rowsLeftOnPage--; + if (_rowStart < 0) { + // Deleted row. Skip. + return positionAtNextRow(); + } else { + // XXX - Handle overflow pages. + _buffer.position(_rowStart); + _buffer.limit(_lastRowStart); + _lastRowStart = _rowStart; + return true; + } } /** @@ -439,7 +444,7 @@ public class Table { for (iter = _columns.iterator(); iter.hasNext() && index < row.size(); index++) { col = (Column) iter.next(); - if (!col.getType().isVariableLength()) { + if (!col.isVariableLength()) { //Fixed length column data comes first if (row.get(index) != null) { buffer.put(col.write(row.get(index))); @@ -464,7 +469,7 @@ public class Table { for (iter = _columns.iterator(); iter.hasNext() && index < row.size(); index++) { col = (Column) iter.next(); short offset = (short) buffer.position(); - if (col.getType().isVariableLength()) { + if (col.isVariableLength()) { if (row.get(index) != null) { buffer.put(col.write(row.get(index))); } |