Package com.opencsv

Class ResultSetHelperService

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static int CLOBBUFFERSIZE  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String[] getColumnNames​(java.sql.ResultSet rs)
      Returns the column names from the ResultSet.
      java.lang.String[] getColumnValues​(java.sql.ResultSet rs)
      Returns the column values from the result set.
      java.lang.String[] getColumnValues​(java.sql.ResultSet rs, boolean trim)
      Returns the column values from the result set with the values trimmed if desired.
      java.lang.String[] getColumnValues​(java.sql.ResultSet rs, boolean trim, java.lang.String dateFormatString, java.lang.String timeFormatString)
      Returns the column values from the result set with the values trimmed if desired.
      protected java.lang.String handleTimestamp​(java.sql.Timestamp timestamp, java.lang.String timestampFormatString)
      The formatted timestamp.
      void setDateFormat​(java.lang.String dateFormat)
      Set a default date format pattern that will be used by the service.
      void setDateTimeFormat​(java.lang.String dateTimeFormat)
      Set a default date time format pattern that will be used by the service.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ResultSetHelperService

        public ResultSetHelperService()
        Default constructor.
    • Method Detail

      • setDateFormat

        public void setDateFormat​(java.lang.String dateFormat)
        Set a default date format pattern that will be used by the service.
        Parameters:
        dateFormat - Desired date format
      • setDateTimeFormat

        public void setDateTimeFormat​(java.lang.String dateTimeFormat)
        Set a default date time format pattern that will be used by the service.
        Parameters:
        dateTimeFormat - Desired date time format
      • getColumnNames

        public java.lang.String[] getColumnNames​(java.sql.ResultSet rs)
                                          throws java.sql.SQLException
        Description copied from interface: ResultSetHelper
        Returns the column names from the ResultSet.
        Specified by:
        getColumnNames in interface ResultSetHelper
        Parameters:
        rs - ResultSet
        Returns:
        String array containing the column names.
        Throws:
        java.sql.SQLException - Thrown by the ResultSet.
      • getColumnValues

        public java.lang.String[] getColumnValues​(java.sql.ResultSet rs)
                                           throws java.sql.SQLException,
                                                  java.io.IOException
        Description copied from interface: ResultSetHelper
        Returns the column values from the result set.
        Specified by:
        getColumnValues in interface ResultSetHelper
        Parameters:
        rs - The ResultSet containing the values.
        Returns:
        String array containing the values.
        Throws:
        java.sql.SQLException - Thrown by the ResultSet.
        java.io.IOException - Thrown by the ResultSet.
      • getColumnValues

        public java.lang.String[] getColumnValues​(java.sql.ResultSet rs,
                                                  boolean trim)
                                           throws java.sql.SQLException,
                                                  java.io.IOException
        Description copied from interface: ResultSetHelper
        Returns the column values from the result set with the values trimmed if desired.
        Specified by:
        getColumnValues in interface ResultSetHelper
        Parameters:
        rs - The ResultSet containing the values.
        trim - Values should have white spaces trimmed.
        Returns:
        String array containing the values.
        Throws:
        java.sql.SQLException - Thrown by the ResultSet.
        java.io.IOException - Thrown by the ResultSet.
      • getColumnValues

        public java.lang.String[] getColumnValues​(java.sql.ResultSet rs,
                                                  boolean trim,
                                                  java.lang.String dateFormatString,
                                                  java.lang.String timeFormatString)
                                           throws java.sql.SQLException,
                                                  java.io.IOException
        Description copied from interface: ResultSetHelper
        Returns the column values from the result set with the values trimmed if desired. Also format the date and time columns based on the format strings passed in.
        Specified by:
        getColumnValues in interface ResultSetHelper
        Parameters:
        rs - The ResultSet containing the values.
        trim - Values should have white spaces trimmed.
        dateFormatString - Format string for dates.
        timeFormatString - Format string for timestamps.
        Returns:
        String array containing the values.
        Throws:
        java.sql.SQLException - Thrown by the ResultSet.
        java.io.IOException - Thrown by the ResultSet.
      • handleTimestamp

        protected java.lang.String handleTimestamp​(java.sql.Timestamp timestamp,
                                                   java.lang.String timestampFormatString)
        The formatted timestamp.
        Parameters:
        timestamp - Timestamp read from resultset
        timestampFormatString - Format string
        Returns:
        Formatted time stamp.