Package uk.ac.starlink.table.jdbc
Class RandomResultSetStarTable
- java.lang.Object
-
- uk.ac.starlink.table.AbstractStarTable
-
- uk.ac.starlink.table.RandomStarTable
-
- uk.ac.starlink.table.jdbc.RandomResultSetStarTable
-
- All Implemented Interfaces:
StarTable
public class RandomResultSetStarTable extends RandomStarTable
StarTable implementation based on a random-accessResultSet. Such results sets have atypeofResultSet.TYPE_SCROLL_*and are generally produced from by using a Statement which has been constructed using corresponding type. This implementation is thread-safe.- Since:
- 23 Jul 2007
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description RandomResultSetStarTable(java.sql.ResultSet rset)Constructor.RandomResultSetStarTable(StarResultSet srset)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectgetCell(long lrow, int icol)The AbstractStarTable implementation of this method throws an UnsupportedOperationException, since unless otherwise provided there is no random access.java.util.List<ValueInfo>getColumnAuxDataInfos()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.intgetColumnCount()Returns the number of columns in this table.ColumnInfogetColumnInfo(int icol)Returns the object describing the data in a given column.java.sql.ResultSetgetResultSet()Returns the result set on which this table is built.java.lang.Object[]getRow(long lrow)The AbstractStarTable implementation of this method constructs a row by repeated invocation ofAbstractStarTable.getCell(long, int).longgetRowCount()The number of rows in this table.-
Methods inherited from class uk.ac.starlink.table.RandomStarTable
getRowSequence, isRandom
-
Methods inherited from class uk.ac.starlink.table.AbstractStarTable
checkedLongToInt, getName, getParameterByName, getParameters, getURL, setName, setParameter, setParameters, setURL
-
-
-
-
Constructor Detail
-
RandomResultSetStarTable
public RandomResultSetStarTable(java.sql.ResultSet rset) throws java.sql.SQLExceptionConstructor.- Parameters:
rset- result set containing data- Throws:
java.lang.IllegalArgumentException- ifrsetis not random accessjava.sql.SQLException
-
RandomResultSetStarTable
public RandomResultSetStarTable(StarResultSet srset)
Constructor.- Parameters:
srset- result set containing data- Throws:
java.lang.IllegalArgumentException- ifsrsetis not random access
-
-
Method Detail
-
getResultSet
public java.sql.ResultSet getResultSet()
Returns the result set on which this table is built.- Returns:
- result set
-
getColumnCount
public int getColumnCount()
Description copied from interface:StarTableReturns the number of columns in this table.- Specified by:
getColumnCountin interfaceStarTable- Specified by:
getColumnCountin classAbstractStarTable- Returns:
- the number of columns
-
getColumnInfo
public ColumnInfo getColumnInfo(int icol)
Description copied from interface:StarTableReturns the object describing the data in a given column.- Specified by:
getColumnInfoin interfaceStarTable- Specified by:
getColumnInfoin classAbstractStarTable- Parameters:
icol- the column for which header information is required- Returns:
- a ValueInfo object for column icol
-
getRowCount
public long getRowCount()
Description copied from class:RandomStarTableThe number of rows in this table. Implementations must supply a non-negative return value.- Specified by:
getRowCountin interfaceStarTable- Specified by:
getRowCountin classRandomStarTable- Returns:
- the number of rows in the table
-
getColumnAuxDataInfos
public java.util.List<ValueInfo> getColumnAuxDataInfos()
Description copied from class:AbstractStarTableGoes 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:
getColumnAuxDataInfosin interfaceStarTable- Overrides:
getColumnAuxDataInfosin classAbstractStarTable- Returns:
- a list of all the auxiliary metadata ValueInfo items which in fact crop up in column metadata
- See Also:
ColumnInfo.getAuxData()
-
getCell
public java.lang.Object getCell(long lrow, int icol) throws java.io.IOExceptionDescription copied from class:AbstractStarTableThe AbstractStarTable implementation of this method throws an UnsupportedOperationException, since unless otherwise provided there is no random access.- Specified by:
getCellin interfaceStarTable- Overrides:
getCellin classAbstractStarTable- Parameters:
lrow- the index of the cell's rowicol- the index of the cell's column- Returns:
- the contents of this cell
- Throws:
java.io.IOException- if there is an error reading the data
-
getRow
public java.lang.Object[] getRow(long lrow) throws java.io.IOExceptionDescription copied from class:AbstractStarTableThe AbstractStarTable implementation of this method constructs a row by repeated invocation ofAbstractStarTable.getCell(long, int).- Specified by:
getRowin interfaceStarTable- Overrides:
getRowin classAbstractStarTable- Parameters:
lrow- the index of the row to retrieve- Returns:
- an array of the objects in each cell in row irow
- Throws:
java.io.IOException- if there is an error reading the data
-
-