List of utility methods to do SQL ResultSet Print
void | printResultSet(ResultSet rs) Prints an arbitrary result set to the console. ResultSetMetaData md; try { md = rs.getMetaData(); int nCols = md.getColumnCount(); int count = 0; while (rs.next()) { for (int i = 0; i < nCols; i++) { String val = rs.getString(i + 1); ... |
void | printResultSetColumns(ResultSet rs) DOC xqliu Comment method "printResultSetColumns". try { ResultSetMetaData metaData = rs.getMetaData(); int columnSize = metaData.getColumnCount(); for (int i = 0; i < columnSize; ++i) { System.out.println("[" + (i + 1) + "]:" + metaData.getColumnName(i + 1)); } catch (SQLException e) { e.printStackTrace(); ... |
int | printResultSetHeader(ResultSet rs) print Result Set Header return printResultSetHeader(rs.getMetaData());
|
void | printResultSetMetadata(ResultSetMetaData rsmd, Writer out) Prints the ResultSetMetaData values for each column int columns = rsmd.getColumnCount(); Class RSMD = ResultSetMetaData.class; Class[] params = { int.class }; int numMethods = METADATA_METHODS.length; String[][] metadataStrings = new String[columns][numMethods]; int[] maxColWidths = new int[numMethods]; for (int i = 0; i < numMethods; i++) { maxColWidths[i] = METADATA_METHODS[i].length(); ... |
void | printResultSetRow(ResultSet rs) print Result Set Row ResultSetMetaData metaData = rs.getMetaData();
int numColumns = printResultSetHeader(metaData);
printResultSetRow(rs, numColumns);
|
int | printResultsToFile(ResultSet rst, File outFile) print Results To File PrintWriter fileprinter = new PrintWriter(outFile); ResultSetMetaData meta = rst.getMetaData(); int numColumns = meta.getColumnCount(); fileprinter.print(meta.getColumnName(1)); for (int j = 2; j <= meta.getColumnCount(); j++) fileprinter.print(", " + meta.getColumnName(j)); fileprinter.println(); int count = 0; ... |
void | printRow(ResultSet pk) print Row System.out.println("--- " + pk.getRow() + ". row ---"); for (int i = 1; i <= pk.getMetaData().getColumnCount(); i++) { System.out.println(pk.getMetaData().getColumnName(i) + ": " + pk.getObject(i)); |
void | printRsetTypeAndConcurrencyType(ResultSet rset) print Rset Type And Concurrency Type int resultSetType = rset.getType(); System.out.print("\tResult set category (using ResultSet API): "); switch (resultSetType) { case ResultSet.TYPE_FORWARD_ONLY: System.out.print("Forward only"); break; case ResultSet.TYPE_SCROLL_INSENSITIVE: System.out.print("Scroll insensitive"); ... |
void | printSet(ResultSet set, int columns) print Set while (set.next()) { for (int i = 1; i <= columns; i++) { System.out.print(set.getString(i) + ", "); System.out.println(); |
void | printValues(final ResultSet resultSet) print Values while (resultSet.next()) { for (int i = 1; i < resultSet.getMetaData().getColumnCount(); i++) { System.out.print(resultSet.getString(i)); System.out.print("\t"); System.out.println("\n"); |