be.six.reports.data
Class DatabaseResult
java.lang.Object
be.six.reports.data.DatabaseResult
public class DatabaseResult
- extends java.lang.Object
An offline representation of the result of a SELECT statement. It tries to convert database types to the equivalent Java type.
Watch out for results with more than 100k rows: the heap space needed will grow significantly. This could lead to heap space errors.
- Author:
- Joren Six
Constructor Summary |
DatabaseResult(java.sql.ResultSetMetaData metaData)
Initializes the database result. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EMPTYRESULT
public static final DatabaseResult EMPTYRESULT
DatabaseResult
public DatabaseResult(java.sql.ResultSetMetaData metaData)
throws java.sql.SQLException
- Initializes the database result.
- Parameters:
metaData
- the meta data for this result. Contains information about the columns.
- Throws:
java.sql.SQLException
- when using the meta data goes awry.
addRow
public void addRow(java.sql.ResultSet rs)
throws java.sql.SQLException
- Adds a row to the DatabaseResult
- Parameters:
rs
- the ResultSet from a SELECT statement.
- Throws:
java.sql.SQLException
- when reading data goes awry.
getRowCount
public int getRowCount()
- Returns:
- the number of rows in the DatabaseResult
getColumnCount
public int getColumnCount()
- Returns:
- the number of columns in the databaseResult
getColumnClass
public java.lang.Class<?> getColumnClass(int col)
- Parameters:
col
- the column
- Returns:
- the class of the selected column
getColumName
public java.lang.String getColumName(int col)
- Parameters:
col
- the column
- Returns:
- the name of the column
getValueAt
public java.lang.Object getValueAt(int row,
int column)
- Parameters:
row
- the rowcolumn
- the column
- Returns:
- the value at the selected position