de.erichseifert.gral.data
Class JdbcData
- java.lang.Object
-
- de.erichseifert.gral.data.AbstractDataSource
-
- de.erichseifert.gral.data.JdbcData
-
- All Implemented Interfaces:
- DataSource, java.io.Serializable, java.lang.Iterable<java.lang.Comparable<?>>
public class JdbcData extends AbstractDataSource
Data source for database tables accessed through a JDBC connection.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description JdbcData(java.sql.Connection connection, java.lang.String table)Initializes a new buffered instance to query the data from a specified table using a specified JDBC connection.JdbcData(java.sql.Connection connection, java.lang.String table, boolean buffered)Initializes a new instance to query the data from a specified table using a specified JDBC connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.Comparable<?>get(int col, int row)Returns the row with the specified index.intgetColumnCount()Returns the number of columns of the data source.intgetRowCount()Returns the number of rows of the data source.booleanisBuffered()Returns whether this data source is buffered.voidsetBuffered(boolean buffered)Determines whether this data source should buffer intermediate results.-
Methods inherited from class de.erichseifert.gral.data.AbstractDataSource
addDataListener, getColumn, getColumnStatistics, getColumnTypes, getName, getRecord, getRow, getRowStatistics, getStatistics, isColumnNumeric, iterator, removeDataListener
-
-
-
-
Constructor Detail
-
JdbcData
public JdbcData(java.sql.Connection connection, java.lang.String table, boolean buffered)Initializes a new instance to query the data from a specified table using a specified JDBC connection. It is assumed the table columns are constant during the connection.- Parameters:
connection- JDBC connection object.table- Properly quoted name of the table.buffered- Turns on buffering of JDBC queries.
-
JdbcData
public JdbcData(java.sql.Connection connection, java.lang.String table)Initializes a new buffered instance to query the data from a specified table using a specified JDBC connection.- Parameters:
connection- JDBC connection object.table- Properly quoted name of the table.
-
-
Method Detail
-
get
public java.lang.Comparable<?> get(int col, int row)Returns the row with the specified index.- Parameters:
col- index of the column to returnrow- index of the row to return- Returns:
- the specified value of the data cell
-
getColumnCount
public int getColumnCount()
Description copied from class:AbstractDataSourceReturns the number of columns of the data source.- Specified by:
getColumnCountin interfaceDataSource- Overrides:
getColumnCountin classAbstractDataSource- Returns:
- number of columns in the data source.
-
getRowCount
public int getRowCount()
Returns the number of rows of the data source.- Returns:
- number of rows in the data source.
-
isBuffered
public boolean isBuffered()
Returns whether this data source is buffered.- Returns:
truewhen this object uses buffering,falseotherwise
-
setBuffered
public void setBuffered(boolean buffered)
Determines whether this data source should buffer intermediate results. This implies that the data doesn't change during access.- Parameters:
buffered-truewhen this object should use buffering,falseotherwise
-
-
DataMelt 3.0 © DataMelt by jWork.ORG