|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| 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 StarTablegetColumnInfo in class AbstractStarTableicol - the column for which header information is required
public List getColumnAuxDataInfos()
AbstractStarTable
getColumnAuxDataInfos in interface StarTablegetColumnAuxDataInfos in class AbstractStarTableColumnInfo.getAuxData()public int getColumnCount()
StarTable
getColumnCount in interface StarTablegetColumnCount in class AbstractStarTablepublic long getRowCount()
StarTable
getRowCount in interface StarTablegetRowCount in class AbstractStarTable
public void setRandom()
throws SQLException
SQLExceptionpublic boolean isRandom()
AbstractStarTable
isRandom in interface StarTableisRandom in class AbstractStarTable
public Object getCell(long lrow,
int icol)
throws IOException
AbstractStarTable
getCell in interface StarTablegetCell in class AbstractStarTablelrow - the index of the cell's rowicol - the index of the cell's column
IOException - if there is an error reading the data
public Object[] getRow(long lrow)
throws IOException
AbstractStarTableAbstractStarTable.getCell(long, int).
getRow in interface StarTablegetRow in class AbstractStarTablelrow - the index of the row to retrieve
IOException - if there is an error reading the data
public RowSequence getRowSequence()
throws IOException
StarTable
getRowSequence in interface StarTablegetRowSequence in class AbstractStarTableIOException - if there is an error providing access
public Connection getConnection()
throws SQLException
SQLExceptionpublic String getSql()
|
Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||