public class DBDump {
public static long runQuery(final String query, final PrintStream p, final DBHandle handle) throws SQLException {
final Statement stmt = handle.createReadStatement();
final RSIterator source = new RSIterator(stmt.executeQuery(query));
final String sep = "\t";
boolean first = true;
long rowNum = 0;
while(source.hasNext()) {
final BurstMap row = source.next();
if(first) {
boolean firstCol = true;
for(final String ki: row.keySet()) {
if(firstCol) {
firstCol = false;
} else {
p.print(sep);
}
final TypeInfo columnInfo = source.getJavaClassName(ki);
p.print(TrivialReader.safeStr(ki) + ":" + columnInfo.sqlColumnType);
}
p.println();
first = false;
}