diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2006-08-04 17:16:59 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2006-08-04 17:16:59 +0000 |
commit | 479c633c30387d9f91ff6cee97adc979d231d59f (patch) | |
tree | 881902e3d672d8afa44b470484556cd53b394fba /test/src/java | |
parent | 8b19c8540bdbf0e1dee4c58a157a209012365167 (diff) | |
download | jackcess-479c633c30387d9f91ff6cee97adc979d231d59f.tar.gz jackcess-479c633c30387d9f91ff6cee97adc979d231d59f.zip |
make database and table iterable; slight rearrangement of logic in getNextRow
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@92 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'test/src/java')
-rw-r--r-- | test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java index a4d6a71..18d3b47 100644 --- a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java @@ -253,9 +253,8 @@ public class DatabaseTest extends TestCase { } private int countRows(Table table) throws Exception { - table.reset(); int rtn = 0; - while (table.getNextRow() != null) { + for(Map<String, Object> row : table) { rtn++; } return rtn; @@ -494,17 +493,14 @@ public class DatabaseTest extends TestCase { private static void dumpDatabase(Database mdb) throws Exception { System.out.println("DATABASE:"); - - for(String tableName : mdb.getTableNames()) { - dumpTable(mdb.getTable(tableName)); + for(Table table : mdb) { + dumpTable(table); } } private static void dumpTable(Table table) throws Exception { System.out.println("TABLE: " + table.getName()); - table.reset(); - Object row = null; - while((row = table.getNextRow()) != null) { + for(Object row : table) { System.out.println(row); } } |