T - the generic type of the implementing typepublic abstract class ParameterizedStatementDefinition<T extends ParameterizedStatementDefinition> extends StatementDefinition<T>
StatementDefinition implementations which have a Map of input parameters.| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Object> |
inputParameters
A
Map which keys are the name of an input parameter to be set on the JDBC prepared statement. |
sql| Constructor and Description |
|---|
ParameterizedStatementDefinition() |
ParameterizedStatementDefinition(String sql,
List<ParameterType> parameterTypes,
Map<String,Object> inputParameters,
int queryTimeout,
TimeUnit queryTimeoutUnit,
Integer fetchSize,
Integer maxRows)
Creates a new instance of ParameterizedStatementDefinition with the given arguments.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addInputParameter(String paramName,
Object value)
Adds a new input parameter
|
protected T |
copy()
Returns a shallow copy of
this instance. |
protected Optional<org.mule.runtime.api.util.Reference<Object>> |
findParameter(Map<String,Object> parameters,
String name) |
Optional<org.mule.runtime.api.util.Reference<Object>> |
getInputParameter(String name)
Optionally returns a parameter of the given
name |
Map<String,Object> |
getInputParameters() |
getParameterType, getParameterTypes, getSql, setSqlcopyInto, getFetchSize, getMaxRows, getQueryTimeout, getQueryTimeoutUnit@Parameter @Content @Optional @NullSafe @TypeResolver(value=DbInputMetadataResolver.class) @Placement(order=2) @DisplayName(value="Input Parameters") @Example(value="#[{\'name\': \"Max\", \'nickname\': \"The Mule\", \'company\': \"MuleSoft\"}]") protected Map<String,Object> inputParameters
Map which keys are the name of an input parameter to be set on the JDBC prepared statement. Each parameter should
be referenced in the sql text using a semicolon prefix (E.g: where id = :myParamName)).
The map's values will contain the actual assignation for each parameter.
public ParameterizedStatementDefinition()
public ParameterizedStatementDefinition(String sql, List<ParameterType> parameterTypes, Map<String,Object> inputParameters, int queryTimeout, TimeUnit queryTimeoutUnit, Integer fetchSize, Integer maxRows)
sql - The text of the SQL query to be executedparameterTypes - Allows to optionally specify the type of one or more of the parameters in the query. If provided,
you're not even required to reference all of the parameters, but you cannot reference a parameter not
present in the input valuesinputParameters - A Map which keys are the name of an input parameter to be set on the JDBC prepared statement.
Each parameter should be referenced in the sql text using a semicolon prefix (E.g:
where id = :myParamName)).
The map's values will contain the actual assignation for each parameter.
queryTimeout - Indicates the minimum amount of time before the JDBC driver attempts to cancel a running statement.
No timeout is used by default.queryTimeoutUnit - A TimeUnit which qualifies the QuerySettings.queryTimeoutfetchSize - Indicates how many rows to fetch from the database when rows are read from a resultSet.maxRows - * Sets the limit for the maximum number of rows that any ResultSet object generated by this message
processor can contain for the given number. If the limit is exceeded, the excess rows are silently
dropped.public Optional<org.mule.runtime.api.util.Reference<Object>> getInputParameter(String name)
namename - the name of the searched parameterOptional ParameterTypeprotected Optional<org.mule.runtime.api.util.Reference<Object>> findParameter(Map<String,Object> parameters, String name)
public Map<String,Object> getInputParameters()
Map with the input parameterspublic void addInputParameter(String paramName, Object value)
paramName - the parameter namevalue - the parameter valueprotected T copy()
StatementDefinitionthis instance.copy in class StatementDefinition<T extends ParameterizedStatementDefinition>Copyright © 2021. All rights reserved.