summaryrefslogtreecommitdiffstats
path: root/test/src/java
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2006-09-21 13:20:07 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2006-09-21 13:20:07 +0000
commit35772d7e9838871792c5f94da425febc91cec01e (patch)
treea201fac8fee34eab6a4dd8168135e5a63c4dcc3c /test/src/java
parentaa7e5d19856b7fd9cb39197211a78c910bf19b53 (diff)
downloadjackcess-35772d7e9838871792c5f94da425febc91cec01e.tar.gz
jackcess-35772d7e9838871792c5f94da425febc91cec01e.zip
add ability to dump to writer
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@117 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'test/src/java')
-rw-r--r--test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java
index 1a65fcf..a383b01 100644
--- a/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java
+++ b/test/src/java/com/healthmarketscience/jackcess/DatabaseTest.java
@@ -5,6 +5,7 @@ package com.healthmarketscience.jackcess;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
@@ -606,16 +607,29 @@ public class DatabaseTest extends TestCase {
}
static void dumpDatabase(Database mdb) throws Exception {
- System.out.println("DATABASE:");
+ dumpDatabase(mdb, new PrintWriter(System.out, true));
+ }
+
+ static void dumpTable(Table table) throws Exception {
+ dumpTable(table, new PrintWriter(System.out, true));
+ }
+
+ static void dumpDatabase(Database mdb, PrintWriter writer) throws Exception {
+ writer.println("DATABASE:");
for(Table table : mdb) {
- dumpTable(table);
+ dumpTable(table, writer);
}
}
- static void dumpTable(Table table) throws Exception {
- System.out.println("TABLE: " + table.getName());
+ static void dumpTable(Table table, PrintWriter writer) throws Exception {
+ writer.println("TABLE: " + table.getName());
+ List<String> colNames = new ArrayList<String>();
+ for(Column col : table.getColumns()) {
+ colNames.add(col.getName());
+ }
+ writer.println("COLUMNS: " + colNames);
for(Object row : table) {
- System.out.println(row);
+ writer.println(row);
}
}