aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2006-08-03 13:38:02 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2006-08-03 13:38:02 +0000
commit9726035fbe9f3d606b45e4254fffe50c315463f9 (patch)
tree59abaab2ae418dd09022c68ceac8cb5efab443df
parentb624ca971b748bfbc7c891ed8f154b4270790148 (diff)
downloadjackcess-9726035fbe9f3d606b45e4254fffe50c315463f9.tar.gz
jackcess-9726035fbe9f3d606b45e4254fffe50c315463f9.zip
fix handling of skipped rows
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@83 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r--src/java/com/healthmarketscience/jackcess/Table.java29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/Table.java b/src/java/com/healthmarketscience/jackcess/Table.java
index 854a6b4..c51798c 100644
--- a/src/java/com/healthmarketscience/jackcess/Table.java
+++ b/src/java/com/healthmarketscience/jackcess/Table.java
@@ -49,6 +49,8 @@ import org.apache.commons.logging.LogFactory;
public class Table {
private static final Log LOG = LogFactory.getLog(Table.class);
+
+ private static final short OFFSET_MASK = (short)0x1FFF;
/** Table type code for system tables */
public static final byte TYPE_SYSTEM = 0x53;
@@ -316,16 +318,19 @@ public class Table {
// code follows the actual code, which disagrees with the HACKING doc
boolean deletedRow = ((_rowStart & 0x4000) != 0);
boolean overflowRow = ((_rowStart & 0x8000) != 0);
+
+ _rowStart = (short)(_rowStart & OFFSET_MASK);
if (deletedRow) {
// Deleted row. Skip.
+ _lastRowStart = _rowStart;
return positionAtNextRow();
} else if (overflowRow) {
// Overflow page.
// FIXME - Currently skipping this. Need to figure out how to read it.
- _buffer.position(_rowStart - 0x4000);
- int overflow = _buffer.getInt();
- _lastRowStart -= 4;
+// _buffer.position(_rowStart);
+// int overflow = _buffer.getInt();
+ _lastRowStart = _rowStart;
return positionAtNextRow();
} else {
_buffer.position(_rowStart);
@@ -692,5 +697,23 @@ public class Table {
}
return rtn.toString();
}
+
+ public static short findRowStart(ByteBuffer buffer, int rowNum,
+ JetFormat format)
+ {
+ return (short)(buffer.getShort(format.OFFSET_ROW_START +
+ (format.SIZE_ROW_LOCATION * rowNum))
+ & OFFSET_MASK);
+ }
+
+ public static short findRowEnd(ByteBuffer buffer, int rowNum,
+ JetFormat format)
+ {
+ return (short)((rowNum == 0) ?
+ format.PAGE_SIZE :
+ (buffer.getShort(format.OFFSET_ROW_START +
+ (format.SIZE_ROW_LOCATION * (rowNum - 1)))
+ & OFFSET_MASK));
+ }
}