Java SQL ResultSet Print printHeader(PrintWriter pw, ResultSet rs)

Here you can find the source of printHeader(PrintWriter pw, ResultSet rs)

Description

print Header

License

Open Source License

Declaration

public static void printHeader(PrintWriter pw, ResultSet rs) throws SQLException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.PrintWriter;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;

public class Main {
    public static void printHeader(PrintWriter pw, ResultSet rs) throws SQLException {
        ResultSetMetaData rsmd = rs.getMetaData();
        for (int i = 1; i <= rsmd.getColumnCount(); i++) {
            pw.print((i == 1 ? rsmd.getColumnName(i) : "\t" + rsmd.getColumnName(i)));
        }//  w  w  w.  ja va 2 s. co m
        pw.println();
    }
}

Related

  1. print(ResultSet resultSet)
  2. print(ResultSet rs, PrintStream out)
  3. print(ResultSet rs, PrintStream out)
  4. printCols(final ResultSetMetaData paymentTableResultSetMetaData, final String logging_prefix)
  5. printColTypes(ResultSetMetaData rsmd)
  6. printHeaders(ResultSetMetaData rsmd, PrintStream out)
  7. printItems(ResultSet rs)
  8. printoutDB(ResultSet rs)
  9. printRecord(PrintWriter pw, ResultSet rs)