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:
Closeable
,AutoCloseable
,StarTable
StarTable implementation based on a random-access
ResultSet
.
Such results sets have a type
of
ResultSet.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
ConstructorsConstructorDescriptionConstructor.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
TheAbstractStarTable
implementation of this method does nothing.getCell
(long lrow, int icol) Implementations of this method must be safe for concurrent calls from multiple threads.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.int
Returns 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.Object[]
getRow
(long lrow) TheAbstractStarTable
implementation of this method constructs a row by repeated invocation ofAbstractStarTable.getCell(long, int)
.long
Implementations must supply a non-negative return value.Methods inherited from class uk.ac.starlink.table.RandomStarTable
getRowAccess, getRowSequence, isRandom
Methods inherited from class uk.ac.starlink.table.AbstractStarTable
checkedLongToInt, getName, getParameters, getRowSplittable, getURL, setName, setParameters, setURL
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface uk.ac.starlink.table.StarTable
getParameterByName, setParameter
-
Constructor Details
-
RandomResultSetStarTable
Constructor.- Parameters:
rset
- result set containing data- Throws:
IllegalArgumentException
- ifrset
is not random accessSQLException
-
RandomResultSetStarTable
Constructor.- Parameters:
srset
- result set containing data- Throws:
IllegalArgumentException
- ifsrset
is not random access
-
-
Method Details
-
getResultSet
Returns the result set on which this table is built.- Returns:
- result set
-
getColumnCount
public int getColumnCount()Description copied from interface:StarTable
Returns the number of columns in this table.- Specified by:
getColumnCount
in interfaceStarTable
- Specified by:
getColumnCount
in classAbstractStarTable
- Returns:
- the number of columns
-
getColumnInfo
Description copied from interface:StarTable
Returns the object describing the data in a given column.- Specified by:
getColumnInfo
in interfaceStarTable
- Specified by:
getColumnInfo
in 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:RandomStarTable
Implementations must supply a non-negative return value.- Specified by:
getRowCount
in interfaceStarTable
- Specified by:
getRowCount
in classRandomStarTable
- Returns:
- the number of rows in the table
-
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 interfaceStarTable
- Overrides:
getColumnAuxDataInfos
in classAbstractStarTable
- Returns:
- a list of all the auxiliary metadata
ValueInfo
items which in fact crop up in column metadata - See Also:
-
getCell
Description copied from class:RandomStarTable
Implementations of this method must be safe for concurrent calls from multiple threads.- Specified by:
getCell
in interfaceStarTable
- Specified by:
getCell
in classRandomStarTable
- Parameters:
lrow
- the index of the cell's rowicol
- the index of the cell's column- Returns:
- the contents of this cell
- Throws:
IOException
- if there is an error reading the data
-
getRow
Description copied from class:AbstractStarTable
TheAbstractStarTable
implementation of this method constructs a row by repeated invocation ofAbstractStarTable.getCell(long, int)
.- Specified by:
getRow
in interfaceStarTable
- Overrides:
getRow
in classAbstractStarTable
- Parameters:
lrow
- the index of the row to retrieve- Returns:
- an array of the objects in each cell in row
irow
- Throws:
IOException
- if there is an error reading the data
-
close
Description copied from class:AbstractStarTable
TheAbstractStarTable
implementation of this method does nothing.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceStarTable
- Overrides:
close
in classAbstractStarTable
- Throws:
IOException
-