|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.table.AbstractStarTable
uk.ac.starlink.table.jdbc.JDBCStarTable
public class JDBCStarTable
A StarTable implementation based on the results of an SQL query on a JDBC table.
Constructor Summary | |
---|---|
JDBCStarTable(Connector connx,
String sql)
Constructs a StarTable representing the data returned by an SQL query using a JDBC connections from a given source, with sequential access only. |
|
JDBCStarTable(Connector connx,
String sql,
boolean isRandom)
Constructs a StarTable representing the data returned by an SQL query using JDBC connections from a given source, optionally providing random access. |
Method Summary | |
---|---|
Object |
getCell(long lrow,
int icol)
The AbstractStarTable implementation of this method throws an UnsupportedOperationException, since unless otherwise provided there is no random access. |
List |
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. |
int |
getColumnCount()
Returns the number of columns in this table. |
ColumnInfo |
getColumnInfo(int icol)
Returns the object describing the data in a given column. |
Connection |
getConnection()
Returns a JDBC Connection that can supply the data for this table. |
Object[] |
getRow(long lrow)
The AbstractStarTable implementation of this method constructs a row by repeated invocation of AbstractStarTable.getCell(long, int) . |
long |
getRowCount()
Returns the number of rows in this table, if known. |
RowSequence |
getRowSequence()
Returns an object which can iterate over all the rows in the table sequentially. |
String |
getSql()
Returns the text of the SQL query used for this table. |
boolean |
isRandom()
The AbstractStarTable implementation of this method returns false. |
void |
setRandom()
Ensures that this table provides random access. |
Methods inherited from class uk.ac.starlink.table.AbstractStarTable |
---|
checkedLongToInt, getName, getParameterByName, getParameters, getURL, setName, setParameter, setParameters, setURL |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JDBCStarTable(Connector connx, String sql) throws SQLException
connx
- object which can supply JDBC connectionssql
- text of the SQL query
SQLException
public JDBCStarTable(Connector connx, String sql, boolean isRandom) throws SQLException
This was initially written to take a Connection
rather than a Connector
object, but it seems that there
are limits to the number of ResultSets that can be
simultaneously open on a Connection.
connx
- object which can supply JDBC connectionssql
- text of the SQL queryisRandom
- whether this table needs to provide random access or
not (there are costs associated with this)
SQLException
Method Detail |
---|
public ColumnInfo getColumnInfo(int icol)
StarTable
getColumnInfo
in interface StarTable
getColumnInfo
in class AbstractStarTable
icol
- the column for which header information is required
public List getColumnAuxDataInfos()
AbstractStarTable
getColumnAuxDataInfos
in interface StarTable
getColumnAuxDataInfos
in class AbstractStarTable
ColumnInfo.getAuxData()
public int getColumnCount()
StarTable
getColumnCount
in interface StarTable
getColumnCount
in class AbstractStarTable
public long getRowCount()
StarTable
getRowCount
in interface StarTable
getRowCount
in class AbstractStarTable
public void setRandom() throws SQLException
SQLException
public boolean isRandom()
AbstractStarTable
isRandom
in interface StarTable
isRandom
in class AbstractStarTable
public Object getCell(long lrow, int icol) throws IOException
AbstractStarTable
getCell
in interface StarTable
getCell
in class AbstractStarTable
lrow
- the index of the cell's rowicol
- the index of the cell's column
IOException
- if there is an error reading the datapublic Object[] getRow(long lrow) throws IOException
AbstractStarTable
AbstractStarTable.getCell(long, int)
.
getRow
in interface StarTable
getRow
in class AbstractStarTable
lrow
- the index of the row to retrieve
IOException
- if there is an error reading the datapublic RowSequence getRowSequence() throws IOException
StarTable
getRowSequence
in interface StarTable
getRowSequence
in class AbstractStarTable
IOException
- if there is an error providing accesspublic Connection getConnection() throws SQLException
SQLException
public String getSql()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |