List of utility methods to do SQL ResultSet Print
String | prettyFormat(ResultSet res) pretty Format StringBuilder sb = new StringBuilder(); ResultSetMetaData rsmd = res.getMetaData(); int numOfColumns = rsmd.getColumnCount(); for (int i = 1; i <= numOfColumns; i++) { if (i > 1) sb.append(", "); String columnName = rsmd.getColumnName(i); sb.append(columnName); ... |
void | print(ResultSet resultSet)try { ResultSetMetaData resultSetMetaData = resultSet.getMetaData(); int columnsNumber = resultSetMetaData.getColumnCount(); while (resultSet.next()) { for (int i = 1; i <= columnsNumber; i++) { if (i > 1) System.out.print(", "); String columnValue = resultSet.getString(i); ... |
void | print(ResultSet rs, PrintStream out) Prints data contained in provided ResultSet instance as tab-separated table; first line will contain column names. final ResultSetMetaData metaData = rs.getMetaData(); final int count = metaData.getColumnCount(); for (int i = 1; i <= count; i++) { out.print(metaData.getColumnName(i) + "\t"); out.println(); while (rs.next()) { for (int i = 1; i <= count; i++) { ... |
void | print(ResultSet rs, PrintStream out) Prints a ResultSet .
ResultSetMetaData meta = rs.getMetaData(); int columns = meta.getColumnCount(); for (int i = 0; i < columns; i++) { if (i > 0) { out.print(","); out.print("\""); out.print(meta.getColumnName(i + 1)); ... |
void | printCols(final ResultSetMetaData paymentTableResultSetMetaData, final String logging_prefix) print Cols System.out.println(logging_prefix); for (int i = 1; i <= paymentTableResultSetMetaData.getColumnCount(); i++) { System.out.print(paymentTableResultSetMetaData.getColumnName(i) + "\t"); System.out.println("\n"); |
void | printColTypes(ResultSetMetaData rsmd) print Col Types int columns = rsmd.getColumnCount(); for (int i = 1; i <= columns; i++) { int jdbcType = rsmd.getColumnType(i); String name = rsmd.getColumnTypeName(i); |
void | printHeader(PrintWriter pw, ResultSet rs) print Header ResultSetMetaData rsmd = rs.getMetaData(); for (int i = 1; i <= rsmd.getColumnCount(); i++) { pw.print((i == 1 ? rsmd.getColumnName(i) : "\t" + rsmd.getColumnName(i))); pw.println(); |
void | printHeaders(ResultSetMetaData rsmd, PrintStream out) print Headers StringBuilder sb = new StringBuilder(); sb.append("| "); for (int i = 1; i <= rsmd.getColumnCount(); i++) { sb.append(rsmd.getColumnLabel(i)).append(" | "); sb.append('\n'); for (int i = 0; i < sb.length(); i++) out.print('-'); ... |
void | printItems(ResultSet rs) print Items try { int columns = rs.getMetaData().getColumnCount(); for (int i = 0; i < columns; i++) { System.out.println(i + ": " + rs.getObject(i + 1)); } catch (SQLException sqle) { sqle.printStackTrace(); |
void | printoutDB(ResultSet rs) printout DB ResultSetMetaData meta = rs.getMetaData(); int cols = meta.getColumnCount() + 1; while (rs.next()) { System.out.println("=== ROW START ==="); for (int i = 1; i < cols; i++) { System.out.println(meta.getColumnName(i) + ": " + rs.getString(i)); System.out.println("=== ROW END ==="); ... |