diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2006-07-24 18:57:11 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2006-07-24 18:57:11 +0000 |
commit | f495acf15344bf72147b6c7c62f6a076093e6014 (patch) | |
tree | 5b6bd5161d8b340408cf143316a434b794a0b403 /test | |
parent | 2097e47024fc0703960ec347e17113c4968031d2 (diff) | |
download | jackcess-f495acf15344bf72147b6c7c62f6a076093e6014.tar.gz jackcess-f495acf15344bf72147b6c7c62f6a076093e6014.zip |
first attempt at reading with deleted columns
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@67 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'test')
-rw-r--r-- | test/data/delColTest.mdb | bin | 0 -> 126976 bytes | |||
-rw-r--r-- | test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java | 29 |
2 files changed, 29 insertions, 0 deletions
diff --git a/test/data/delColTest.mdb b/test/data/delColTest.mdb Binary files differnew file mode 100644 index 0000000..b931b0d --- /dev/null +++ b/test/data/delColTest.mdb diff --git a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java index 2dba448..86f1bdd 100644 --- a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java @@ -258,6 +258,35 @@ public class DatabaseTest extends TestCase { return rtn; } + public void testReadWithDeletedCols() throws Exception { + Table table = Database.open(new File("test/data/delColTest.mdb")).getTable("Table1"); + + Map<String, Object> expectedRow0 = new HashMap<String, Object>(); + expectedRow0.put("id", 0); + expectedRow0.put("id2", 2); + expectedRow0.put("data", "foo"); + expectedRow0.put("data2", "foo2"); + + Map<String, Object> expectedRow1 = new HashMap<String, Object>(); + expectedRow1.put("id", 3); + expectedRow1.put("id2", 5); + expectedRow1.put("data", "bar"); + expectedRow1.put("data2", "bar2"); + + int rowNum = 0; + Map<String, Object> row = null; + while ((row = table.getNextRow()) != null) { + if(rowNum == 0) { + assertEquals(expectedRow0, row); + } else if(rowNum == 1) { + assertEquals(expectedRow1, row); + } else if(rowNum >= 2) { + fail("should only have 2 rows"); + } + rowNum++; + } + } + private Object[] createTestRow() { return new Object[] {"Tim", "R", "McCune", 1234, (byte) 0xad, 555.66d, 777.88f, (short) 999, new Date()}; |