Class SequentialResultSetStarTable

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, StarTable

    public class SequentialResultSetStarTable
    extends AbstractStarTable
    StarTable implementation based on a ResultSet. It can read through the data once, and no more.

    Beware: it therefore breaks the general contract of StarTable, in that calls of getRowSequence() after the first one will throw a UnrepeatableSequenceException. Only use this class if you know that the table needs to be read once only.

    Since:
    23 Jul 2007
    Author:
    Mark Taylor
    • Constructor Detail

      • SequentialResultSetStarTable

        public SequentialResultSetStarTable​(java.sql.ResultSet rset)
                                     throws java.sql.SQLException
        Constructor.
        Parameters:
        rset - result set containing data - should be positioned at start
        Throws:
        java.sql.SQLException
      • SequentialResultSetStarTable

        public SequentialResultSetStarTable​(StarResultSet srset)
        Constructs from a StarResultSet.
        Parameters:
        srset - result set containing data - should be positioned at start
    • Method Detail

      • getResultSet

        public java.sql.ResultSet getResultSet()
        Returns the result set on which this table is built.
        Returns:
        result set
      • getColumnInfo

        public ColumnInfo getColumnInfo​(int icol)
        Description copied from interface: StarTable
        Returns the object describing the data in a given column.
        Specified by:
        getColumnInfo in interface StarTable
        Specified by:
        getColumnInfo in class AbstractStarTable
        Parameters:
        icol - the column for which header information is required
        Returns:
        a ValueInfo object for column icol
      • getRowCount

        public long getRowCount()
        Description copied from interface: StarTable
        Returns the number of rows in this table, if known. If the number of rows cannot be (easily) determined, a value of -1 will be returned.
        Specified by:
        getRowCount in interface StarTable
        Specified by:
        getRowCount in class AbstractStarTable
        Returns:
        the number of rows, or -1
      • getColumnAuxDataInfos

        public java.util.List<ValueInfo> getColumnAuxDataInfos()
        Description copied from class: AbstractStarTable
        Goes through the table columns (ColumnInfo objects) and picks out all the AuxData items which exist, generalising where necessary and returning a union of them in alphabetical order by name. Subclasses should override this if they can do better, for instance providing an order for the keys.
        Specified by:
        getColumnAuxDataInfos in interface StarTable
        Overrides:
        getColumnAuxDataInfos in class AbstractStarTable
        Returns:
        a list of all the auxiliary metadata ValueInfo items which in fact crop up in column metadata
        See Also:
        DefaultValueInfo.getAuxData()
      • close

        public void close()
                   throws java.io.IOException
        Description copied from class: AbstractStarTable
        The AbstractStarTable implementation of this method does nothing.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface StarTable
        Overrides:
        close in class AbstractStarTable
        Throws:
        java.io.IOException