public class JRJdbcQueryExecuter extends JRAbstractQueryExecuter
JRAbstractQueryExecuter.QueryParameter, JRAbstractQueryExecuter.QueryParameterEntry, JRAbstractQueryExecuter.QueryParameterVisitor, JRAbstractQueryExecuter.ValuedQueryParameter, JRAbstractQueryExecuter.VisitExceptionWrapper
CLAUSE_POSITION_ID, clauseFunctions, dataset, EXCEPTION_MESSAGE_KEY_NUMERIC_TYPE_REQUIRED, EXCEPTION_MESSAGE_KEY_PARAMETER_NOT_FOUND, EXCEPTION_MESSAGE_KEY_QUERY_CLAUSE_CIRCULARLY_NESTED_PARAMETER, EXCEPTION_MESSAGE_KEY_QUERY_CLAUSE_ID_FIRST_TOKEN_MISSING, EXCEPTION_MESSAGE_KEY_QUERY_CLAUSE_NOT_FOUND, EXCEPTION_MESSAGE_KEY_UNSUPPORTED_PARAMETER_TYPE, GET_COLLECTED
Constructor and Description |
---|
JRJdbcQueryExecuter(JasperReportsContext jasperReportsContext,
JRDataset dataset,
Map<String,? extends JRValueParameter> parameters) |
Modifier and Type | Method and Description |
---|---|
boolean |
cancelQuery()
Cancels the query if it's currently running.
|
void |
close()
Closes resources kept open during the data source iteration.
|
protected void |
closeStatement() |
JRDataSource |
createDatasource()
Executes the query and creates a
JRDataSource out of the result. |
protected void |
createStatement() |
protected String |
getCanonicalQueryLanguage()
Returns a canonical query language for this query executer implementation.
|
protected static int |
getConcurrency(String concurrency) |
protected static int |
getHoldability(String holdability,
Connection connection) |
protected Calendar |
getParameterCalendar(JRPropertiesHolder properties) |
protected String |
getParameterReplacement(String parameterName)
Returns the replacement text for a query parameter.
|
ResultSet |
getResultSet() |
protected static int |
getResultSetType(String type) |
protected void |
initProcedureCall(CallableStatement callableStatement) |
protected boolean |
isProcedureCall(String queryString) |
protected void |
registerFunctions()
Registers built-in
clause functions . |
protected TimeZone |
resolveTimeZone(String timezoneId) |
protected void |
setDate(int parameterIndex,
Object parameterValue,
JRPropertiesHolder properties) |
protected void |
setStatementMultiParameter(int parameterIndex,
String parameterName,
int valueIndex,
Object value,
JRPropertiesHolder properties) |
protected int |
setStatementMultiParameters(int parameterIndex,
String parameterName,
boolean ignoreNulls) |
protected void |
setStatementParameter(int parameterIndex,
Class<?> parameterType,
Object parameterValue,
JRPropertiesHolder properties) |
protected void |
setStatementParameter(int parameterIndex,
String parameterName) |
protected void |
setTime(int parameterIndex,
Object parameterValue,
JRPropertiesHolder properties) |
protected void |
setTimestamp(int parameterIndex,
Object parameterValue,
JRPropertiesHolder properties) |
protected void |
setTimeZone() |
addQueryMultiParameters, addQueryMultiParameters, addQueryParameter, addQueryParameter, appendClauseChunk, appendParameterChunk, appendParameterClauseChunk, appendQueryChunk, appendTextChunk, applyClause, checkParameter, findExtensionQueryFunction, getBooleanParameter, getBooleanParameter, getBooleanParameterOrProperty, getBooleanParameterOrProperty, getCollectedParameterNames, getCollectedParameters, getJasperReportsContext, getParameter, getParameterValue, getParameterValue, getPropertiesUtil, getQueryString, getStringParameter, getStringParameterOrProperty, getValueParameter, getValueParameter, parameterHasValue, parseQuery, registerClauseFunction, resolveFunction, unregisterClauseFunction, visitQueryParameters
public static final String EXCEPTION_MESSAGE_KEY_MULTI_PARAMETERS_CANNOT_CONTAIN_NULL_VALUES
public static final String EXCEPTION_MESSAGE_KEY_QUERY_STATEMENT_CANCEL_ERROR
public static final String EXCEPTION_MESSAGE_KEY_QUERY_STATEMENT_EXECUTE_ERROR
public static final String EXCEPTION_MESSAGE_KEY_QUERY_STATEMENT_PREPARE_ERROR
public static final String EXCEPTION_MESSAGE_KEY_UNEXPECTED_MULTI_PARAMETER_TYPE
public static final String CANONICAL_LANGUAGE
public static final String CLAUSE_ID_IN
public static final String CLAUSE_ID_NOTIN
public static final String CLAUSE_ID_EQUAL
public static final String CLAUSE_ID_NOTEQUAL
public static final String CLAUSE_ID_LESS
public static final String CLAUSE_ID_GREATER
public static final String CLAUSE_ID_LESS_OR_EQUAL
public static final String CLAUSE_ID_GREATER_OR_EQUAL
public static final String CLAUSE_ID_BETWEEN
public static final String CLAUSE_ID_BETWEEN_CLOSED
public static final String CLAUSE_ID_BETWEEN_LEFT_CLOSED
public static final String CLAUSE_ID_BETWEEN_RIGHT_CLOSED
protected static final String TYPE_FORWARD_ONLY
protected static final String TYPE_SCROLL_INSENSITIVE
protected static final String TYPE_SCROLL_SENSITIVE
protected static final String CONCUR_READ_ONLY
protected static final String CONCUR_UPDATABLE
protected static final String HOLD_CURSORS_OVER_COMMIT
protected static final String CLOSE_CURSORS_AT_COMMIT
protected static final String CACHED_ROWSET_CLASS
protected static final Pattern PROCEDURE_CALL_PATTERN
protected Connection connection
protected PreparedStatement statement
protected ResultSet resultSet
public JRJdbcQueryExecuter(JasperReportsContext jasperReportsContext, JRDataset dataset, Map<String,? extends JRValueParameter> parameters)
protected void registerFunctions()
clause functions
.protected String getCanonicalQueryLanguage()
JRAbstractQueryExecuter
The canonical language is used to retrieve extensions for the query executer.
The default implementation returns the runtime query language used in the dataset, but query executer implementations should override this method and return a fixed language.
getCanonicalQueryLanguage
in class JRAbstractQueryExecuter
protected void setTimeZone()
protected String getParameterReplacement(String parameterName)
JRAbstractQueryExecuter
getParameterReplacement
in class JRAbstractQueryExecuter
parameterName
- the parameter nameJRQueryChunk.TYPE_PARAMETER
public JRDataSource createDatasource() throws JRException
JRQueryExecuter
JRDataSource
out of the result.JRDataSource
wrapping the query execution result.JRException
protected void createStatement() throws JRException
JRException
protected boolean isProcedureCall(String queryString) throws SQLException
SQLException
protected void initProcedureCall(CallableStatement callableStatement) throws SQLException
SQLException
public ResultSet getResultSet()
protected void setStatementParameter(int parameterIndex, String parameterName) throws SQLException
SQLException
protected int setStatementMultiParameters(int parameterIndex, String parameterName, boolean ignoreNulls) throws SQLException
SQLException
protected void setStatementMultiParameter(int parameterIndex, String parameterName, int valueIndex, Object value, JRPropertiesHolder properties) throws SQLException
SQLException
protected void setStatementParameter(int parameterIndex, Class<?> parameterType, Object parameterValue, JRPropertiesHolder properties) throws SQLException
SQLException
protected void setTimestamp(int parameterIndex, Object parameterValue, JRPropertiesHolder properties) throws SQLException
SQLException
protected void setTime(int parameterIndex, Object parameterValue, JRPropertiesHolder properties) throws SQLException
SQLException
protected void setDate(int parameterIndex, Object parameterValue, JRPropertiesHolder properties) throws SQLException
SQLException
protected Calendar getParameterCalendar(JRPropertiesHolder properties)
public void close()
JRQueryExecuter
createDatasource
.protected void closeStatement()
public boolean cancelQuery() throws JRException
JRQueryExecuter
true
if and only if the query was running and it has been canceledJRException
protected static int getResultSetType(String type)
protected static int getConcurrency(String concurrency)
protected static int getHoldability(String holdability, Connection connection) throws SQLException
SQLException
Copyright © 2016. All rights reserved.