public class JRResultSetDataSource extends java.lang.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 java.lang.String |
EXCEPTION_MESSAGE_KEY_RESULT_SET_CLOB_VALUE_READ_FAILURE |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_RESULT_SET_COLUMN_INDEX_OUT_OF_RANGE |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_RESULT_SET_FIELD_VALUE_NOT_RETRIEVED |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_RESULT_SET_METADATA_NOT_RETRIEVED |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_RESULT_SET_NEXT_RECORD_NOT_RETRIEVED |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_RESULT_SET_UNKNOWN_COLUMN_NAME |
static java.lang.String |
INDEXED_COLUMN_PREFIX |
Constructor and Description |
---|
JRResultSetDataSource(JasperReportsContext jasperReportsContext,
java.sql.ResultSet resultSet) |
JRResultSetDataSource(java.sql.ResultSet resultSet) |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
clobToString(java.sql.Clob clob) |
protected java.util.Calendar |
createFieldCalendar(JRField field) |
protected java.io.CharArrayReader |
getArrayReader(java.io.Reader reader,
long size) |
protected java.util.Calendar |
getFieldCalendar(JRField field) |
java.lang.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(java.io.InputStream is,
long size) |
protected byte[] |
readBytes(java.lang.Integer columnIndex) |
protected java.lang.Object |
readDate(java.lang.Integer columnIndex,
JRField field) |
protected java.lang.Object |
readTime(java.lang.Integer columnIndex,
JRField field) |
protected java.lang.Object |
readTimestamp(java.lang.Integer columnIndex,
JRField field) |
protected java.util.TimeZone |
resolveTimeZone(java.lang.String timezoneId) |
protected java.lang.Integer |
searchColumnByLabel(java.lang.String fieldName) |
protected java.lang.Integer |
searchColumnByName(java.lang.String fieldName) |
void |
setReportTimeZone(java.util.TimeZone reportTimeZone)
Sets the report time zone, which is the one used to display datetime values in the report.
|
void |
setTimeZone(java.util.TimeZone timeZone,
boolean override)
Sets the default time zone to be used for retrieving date/time values from the
result set.
|
public static final java.lang.String INDEXED_COLUMN_PREFIX
public static final java.lang.String EXCEPTION_MESSAGE_KEY_RESULT_SET_CLOB_VALUE_READ_FAILURE
public static final java.lang.String EXCEPTION_MESSAGE_KEY_RESULT_SET_COLUMN_INDEX_OUT_OF_RANGE
public static final java.lang.String EXCEPTION_MESSAGE_KEY_RESULT_SET_FIELD_VALUE_NOT_RETRIEVED
public static final java.lang.String EXCEPTION_MESSAGE_KEY_RESULT_SET_METADATA_NOT_RETRIEVED
public static final java.lang.String EXCEPTION_MESSAGE_KEY_RESULT_SET_UNKNOWN_COLUMN_NAME
public static final java.lang.String EXCEPTION_MESSAGE_KEY_RESULT_SET_NEXT_RECORD_NOT_RETRIEVED
public JRResultSetDataSource(JasperReportsContext jasperReportsContext, java.sql.ResultSet resultSet)
public JRResultSetDataSource(java.sql.ResultSet resultSet)
public boolean next() throws JRException
JRDataSource
next
in interface JRDataSource
JRException
- if any error occurs while trying to move to the next elementpublic java.lang.Object getFieldValue(JRField field) throws JRException
JRDataSource
getFieldValue
in interface JRDataSource
JRException
protected java.lang.Object readDate(java.lang.Integer columnIndex, JRField field) throws java.sql.SQLException
java.sql.SQLException
protected java.lang.Object readTimestamp(java.lang.Integer columnIndex, JRField field) throws java.sql.SQLException
java.sql.SQLException
protected java.lang.Object readTime(java.lang.Integer columnIndex, JRField field) throws java.sql.SQLException
java.sql.SQLException
protected java.lang.Integer searchColumnByName(java.lang.String fieldName) throws java.sql.SQLException
java.sql.SQLException
protected java.lang.Integer searchColumnByLabel(java.lang.String fieldName) throws java.sql.SQLException
java.sql.SQLException
protected java.lang.String clobToString(java.sql.Clob clob) throws JRException
JRException
protected java.io.CharArrayReader getArrayReader(java.io.Reader reader, long size) throws java.io.IOException
java.io.IOException
protected byte[] readBytes(java.lang.Integer columnIndex) throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
protected byte[] readBytes(java.io.InputStream is, long size) throws java.io.IOException
java.io.IOException
public void setTimeZone(java.util.TimeZone timeZone, boolean override)
timeZone
- the default time zoneoverride
- whether the default time zone overrides time zones specified
as field-level propertiesJRJdbcQueryExecuterFactory.PROPERTY_TIME_ZONE
public void setReportTimeZone(java.util.TimeZone reportTimeZone)
JRJdbcQueryExecuterFactory.PROPERTY_TIME_ZONE
property
is set to REPORT_TIME_ZONE.reportTimeZone
- the time zone used to display datetime values in the reportprotected java.util.Calendar getFieldCalendar(JRField field)
protected java.util.Calendar createFieldCalendar(JRField field)
protected java.util.TimeZone resolveTimeZone(java.lang.String timezoneId)
© 2001-2014 TIBCO Software Inc. www.jaspersoft.com