public class JDBCStarTable extends AbstractStarTable
| Constructor and Description |
|---|
JDBCStarTable(Connector connx,
java.lang.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,
java.lang.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.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
getCell(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. |
int |
getColumnCount()
Returns the number of columns in this table.
|
ColumnInfo |
getColumnInfo(int icol)
Returns the object describing the data in a given column.
|
java.sql.Connection |
getConnection()
Returns a JDBC Connection that can supply the data for this table.
|
java.lang.Object[] |
getRow(long lrow)
The
AbstractStarTable implementation of this method
constructs a row by repeated invocation of AbstractStarTable.getCell(long, int). |
RowAccess |
getRowAccess()
Returns an object which can provide random access to this
table's data, if random access is implemented.
|
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.
|
java.lang.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.
|
checkedLongToInt, close, getName, getParameters, getRowSplittable, getURL, setName, setParameters, setURLclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetParameterByName, setParameterpublic JDBCStarTable(Connector connx, java.lang.String sql) throws java.sql.SQLException
connx - object which can supply JDBC connectionssql - text of the SQL queryjava.sql.SQLExceptionpublic JDBCStarTable(Connector connx, java.lang.String sql, boolean isRandom) throws java.sql.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)java.sql.SQLExceptionpublic ColumnInfo getColumnInfo(int icol)
StarTablegetColumnInfo in interface StarTablegetColumnInfo in class AbstractStarTableicol - the column for which header information is requiredicolpublic java.util.List<ValueInfo> getColumnAuxDataInfos()
AbstractStarTableColumnInfo 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.getColumnAuxDataInfos in interface StarTablegetColumnAuxDataInfos in class AbstractStarTableValueInfo
items which in fact crop up in column metadataDefaultValueInfo.getAuxData()public int getColumnCount()
StarTablegetColumnCount in interface StarTablegetColumnCount in class AbstractStarTablepublic long getRowCount()
StarTablegetRowCount in interface StarTablegetRowCount in class AbstractStarTablepublic void setRandom()
throws java.sql.SQLException
isRandom method will return true.
Calling this method multiple times is harmless.java.sql.SQLExceptionpublic boolean isRandom()
AbstractStarTableAbstractStarTable implementation of this method
returns false.isRandom in interface StarTableisRandom in class AbstractStarTabletrue if table random access methods are availablepublic java.lang.Object getCell(long lrow,
int icol)
throws java.io.IOException
AbstractStarTableAbstractStarTable implementation of this method
throws an UnsupportedOperationException,
since unless otherwise provided there is no random access.getCell in interface StarTablegetCell in class AbstractStarTablelrow - the index of the cell's rowicol - the index of the cell's columnjava.io.IOException - if there is an error reading the datapublic java.lang.Object[] getRow(long lrow)
throws java.io.IOException
AbstractStarTableAbstractStarTable implementation of this method
constructs a row by repeated invocation of AbstractStarTable.getCell(long, int).getRow in interface StarTablegetRow in class AbstractStarTablelrow - the index of the row to retrieveirowjava.io.IOException - if there is an error reading the datapublic RowAccess getRowAccess() throws java.io.IOException
StarTablegetRowAccess in interface StarTablegetRowAccess in class AbstractStarTablejava.io.IOException - if there is an error setting up accesspublic RowSequence getRowSequence() throws java.io.IOException
StarTablegetRowSequence in interface StarTablegetRowSequence in class AbstractStarTablejava.io.IOException - if there is an error providing accesspublic java.sql.Connection getConnection()
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.lang.String getSql()