示例#1
0
  /**
   * Writes the entire ResultSet to a CSV file.
   *
   * <p>The caller is responsible for closing the ResultSet.
   *
   * @param rs the recordset to write
   * @param includeColumnNames true if you want column names in the output, false otherwise
   * @throws java.io.IOException thrown by getColumnValue
   * @throws java.sql.SQLException thrown by getColumnValue
   */
  public void writeAll(java.sql.ResultSet rs, boolean includeColumnNames)
      throws SQLException, IOException {

    if (includeColumnNames) {
      writeColumnNames(rs);
    }

    while (rs.next()) {
      writeNext(resultService.getColumnValues(rs));
    }
  }