Class SequentialResultSetStarTable
java.lang.Object
uk.ac.starlink.table.AbstractStarTable
uk.ac.starlink.table.jdbc.SequentialResultSetStarTable
- All Implemented Interfaces:
Closeable, AutoCloseable, StarTable
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 Summary
ConstructorsConstructorDescriptionConstructor.Constructs from a StarResultSet. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()TheAbstractStarTableimplementation of this method does nothing.Goes through the table columns (ColumnInfoobjects) and picks out all the AuxData items which exist, generalising where necessary and returning a union of them in alphabetical order by name.intReturns the number of columns in this table.getColumnInfo(int icol) Returns the object describing the data in a given column.Returns the result set on which this table is built.longReturns the number of rows in this table, if known.The first time it is called, returns an iterator over the rows of the result set.Methods inherited from class AbstractStarTable
checkedLongToInt, getCell, getName, getParameters, getRow, getRowAccess, getRowSplittable, getURL, isRandom, setName, setParameters, setURLMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface StarTable
getParameterByName, setParameter
-
Constructor Details
-
SequentialResultSetStarTable
Constructor.- Parameters:
rset- result set containing data - should be positioned at start- Throws:
SQLException
-
SequentialResultSetStarTable
Constructs from a StarResultSet.- Parameters:
srset- result set containing data - should be positioned at start
-
-
Method Details
-
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
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 interface:StarTableReturns 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:
getRowCountin interfaceStarTable- Specified by:
getRowCountin classAbstractStarTable- Returns:
- the number of rows, or -1
-
getColumnAuxDataInfos
Description copied from class:AbstractStarTableGoes through the table columns (ColumnInfoobjects) 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
ValueInfoitems which in fact crop up in column metadata - See Also:
-
getRowSequence
The first time it is called, returns an iterator over the rows of the result set. Subsequent calls will throw anUnrepeatableSequenceException.- Specified by:
getRowSequencein interfaceStarTable- Specified by:
getRowSequencein classAbstractStarTable- Returns:
- new RowSequence
- Throws:
UnrepeatableSequenceException- if called more than onceIOException- if there is an error providing access
-
close
Description copied from class:AbstractStarTableTheAbstractStarTableimplementation of this method does nothing.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceStarTable- Overrides:
closein classAbstractStarTable- Throws:
IOException
-