Interface ICsvResultSetWriter

All Superinterfaces:
AutoCloseable, Closeable, Flushable, ICsvWriter
All Known Implementing Classes:
CsvResultSetWriter

public interface ICsvResultSetWriter extends ICsvWriter
Interface for CSV writers writing JDBC ResultSet
Since:
2.4.0
  • Method Details

    • write

      void write(ResultSet resultSet) throws SQLException, IOException
      Writes a JDBC ResultSet as a CSV file. Each column in CSV file corresponds to a column in ResultSet, column order is preserved. Column names in CSV file corresponds to column names stored in ResultSetMetaData. toString will be called on each element prior to writing.
      Parameters:
      resultSet - ResultSet containing the values to write
      Throws:
      SQLException - if a database access error occurs or this method is called on a closed result set
      IOException - if an I/O error occurred
      NullPointerException - if resultSet is null
      SuperCsvException - if there was a general exception while writing
      Since:
      2.4.0
    • write

      void write(ResultSet resultSet, CellProcessor[] cellProcessors) throws SQLException, IOException
      Writes a JDBC ResultSet as a CSV file. Each column in CSV file corresponds to a column in ResultSet, column order is preserved. Column names in CSV file corresponds to column names stored in ResultSetMetaData. toString will be called on each (processed) element prior to writing.
      Parameters:
      resultSet - ResultSet containing the values to write
      cellProcessors - Array of CellProcessors used to further process data before it is written (each element in the processors array corresponds with a CSV column - the number of processors should match the number of columns). A null entry indicates no further processing is required (the value returned by toString() will be written as the column value).
      Throws:
      SQLException - if a database access error occurs or this method is called on a closed result set
      IOException - if an I/O error occurred
      NullPointerException - if resultSet or cellProcessors is null
      SuperCsvConstraintViolationException - if a CellProcessor constraint failed
      SuperCsvException - if there was a general exception while writing/processing
      Since:
      2.4.0