public class JRResultSetDataSource extends Object implements JRDataSource
JRDataSource interface. Since most reports are
generated using data from a relational database, JasperReports includes by default this
implementation that wraps a java.sql.ResultSet object.
This class can be instantiated intentionally to wrap already loaded result sets before passing them to the report-filling routines, but it is also used by the reporting engine to wrap the data retrieved from the database after having executed the report query (if present) through JDBC.
| Modifier and Type | Field and Description |
|---|---|
static String |
INDEXED_COLUMN_PREFIX |
| Constructor and Description |
|---|
JRResultSetDataSource(JasperReportsContext jasperReportsContext,
ResultSet resultSet) |
JRResultSetDataSource(ResultSet resultSet) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
clobToString(Clob clob) |
protected Calendar |
createFieldCalendar(JRField field) |
protected CharArrayReader |
getArrayReader(Reader reader,
long size) |
protected Calendar |
getFieldCalendar(JRField field) |
Object |
getFieldValue(JRField field)
Gets the field value for the current position.
|
boolean |
next()
Tries to position the cursor on the next element in the data source.
|
protected byte[] |
readBytes(InputStream is,
long size) |
protected byte[] |
readBytes(Integer columnIndex) |
protected Object |
readDate(Integer columnIndex,
JRField field) |
protected Object |
readTime(Integer columnIndex,
JRField field) |
protected Object |
readTimestamp(Integer columnIndex,
JRField field) |
protected Integer |
searchColumnByLabel(String fieldName) |
protected Integer |
searchColumnByName(String fieldName) |
void |
setTimeZone(TimeZone timeZone,
boolean override)
Sets the default time zone to be used for retrieving date/time values from the
result set.
|
public static final String INDEXED_COLUMN_PREFIX
public JRResultSetDataSource(JasperReportsContext jasperReportsContext, ResultSet resultSet)
public JRResultSetDataSource(ResultSet resultSet)
public boolean next()
throws JRException
JRDataSourcenext in interface JRDataSourceJRException - if any error occurs while trying to move to the next elementpublic Object getFieldValue(JRField field) throws JRException
JRDataSourcegetFieldValue in interface JRDataSourceJRExceptionprotected Object readDate(Integer columnIndex, JRField field) throws SQLException
SQLExceptionprotected Object readTimestamp(Integer columnIndex, JRField field) throws SQLException
SQLExceptionprotected Object readTime(Integer columnIndex, JRField field) throws SQLException
SQLExceptionprotected Integer searchColumnByName(String fieldName) throws SQLException
SQLExceptionprotected Integer searchColumnByLabel(String fieldName) throws SQLException
SQLExceptionprotected String clobToString(Clob clob) throws JRException
JRExceptionprotected CharArrayReader getArrayReader(Reader reader, long size) throws IOException
IOExceptionprotected byte[] readBytes(Integer columnIndex) throws SQLException, IOException
SQLExceptionIOExceptionprotected byte[] readBytes(InputStream is, long size) throws IOException
IOExceptionpublic void setTimeZone(TimeZone timeZone, boolean override)
timeZone - the default time zoneoverride - whether the default time zone overrides time zones specified
as field-level propertiesJRJdbcQueryExecuterFactory.PROPERTY_TIME_ZONECopyright © 2014. All rights reserved.