From 35772d7e9838871792c5f94da425febc91cec01e Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Thu, 21 Sep 2006 13:20:07 +0000 Subject: [PATCH] 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 --- .../jackcess/DatabaseTest.java | 24 +++++++++++++++---- 1 file 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 colNames = new ArrayList(); + for(Column col : table.getColumns()) { + colNames.add(col.getName()); + } + writer.println("COLUMNS: " + colNames); for(Object row : table) { - System.out.println(row); + writer.println(row); } } -- 2.39.5