From f495acf15344bf72147b6c7c62f6a076093e6014 Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Mon, 24 Jul 2006 18:57:11 +0000 Subject: 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 --- test/data/delColTest.mdb | Bin 0 -> 126976 bytes .../healthmarketscience/jackcess/DatabaseTest.java | 29 +++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 test/data/delColTest.mdb (limited to 'test') diff --git a/test/data/delColTest.mdb b/test/data/delColTest.mdb new file mode 100644 index 0000000..b931b0d Binary files /dev/null and b/test/data/delColTest.mdb differ 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 expectedRow0 = new HashMap(); + expectedRow0.put("id", 0); + expectedRow0.put("id2", 2); + expectedRow0.put("data", "foo"); + expectedRow0.put("data2", "foo2"); + + Map expectedRow1 = new HashMap(); + expectedRow1.put("id", 3); + expectedRow1.put("id2", 5); + expectedRow1.put("data", "bar"); + expectedRow1.put("data2", "bar2"); + + int rowNum = 0; + Map 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()}; -- cgit v1.2.3