public class DefaultSqlPrepareStatementStrategy extends Object implements SqlPrepareStatementStrategy
SqlPrepareStatementStrategy
that supports named query parameters as well index based.Constructor and Description |
---|
DefaultSqlPrepareStatementStrategy() |
DefaultSqlPrepareStatementStrategy(char separator) |
Modifier and Type | Method and Description |
---|---|
protected static org.springframework.util.CompositeIterator |
createInParameterIterator(Object value) |
Iterator<?> |
createPopulateIterator(String query,
String preparedQuery,
int expectedParams,
org.apache.camel.Exchange exchange,
Object value)
Creates the iterator to use when setting query parameters on the prepared statement.
|
protected boolean |
hasNamedParameters(String query) |
protected static boolean |
hasParameter(String nextParam,
org.apache.camel.Exchange exchange,
Object body) |
protected static Object |
lookupParameter(String nextParam,
org.apache.camel.Exchange exchange,
Object body) |
void |
populateStatement(PreparedStatement ps,
Iterator<?> iterator,
int expectedParams)
Populates the query parameters on the prepared statement
|
String |
prepareQuery(String query,
boolean allowNamedParameters,
org.apache.camel.Exchange exchange)
Prepares the query to be executed.
|
public DefaultSqlPrepareStatementStrategy()
public DefaultSqlPrepareStatementStrategy(char separator)
public String prepareQuery(String query, boolean allowNamedParameters, org.apache.camel.Exchange exchange) throws SQLException
SqlPrepareStatementStrategy
prepareQuery
in interface SqlPrepareStatementStrategy
query
- the query which may contain named query parametersallowNamedParameters
- whether named parameters is allowedexchange
- the current exchangeSQLException
public Iterator<?> createPopulateIterator(String query, String preparedQuery, int expectedParams, org.apache.camel.Exchange exchange, Object value) throws SQLException
SqlPrepareStatementStrategy
createPopulateIterator
in interface SqlPrepareStatementStrategy
query
- the original query which may contain named parameterspreparedQuery
- the query to actually use, which must be accepted by the JDBC driver.expectedParams
- number of expected parametersexchange
- the current exchangevalue
- the message body that contains the data for the query parametersSQLException
- is thrown if error creating the iteratorpublic void populateStatement(PreparedStatement ps, Iterator<?> iterator, int expectedParams) throws SQLException
SqlPrepareStatementStrategy
populateStatement
in interface SqlPrepareStatementStrategy
ps
- the prepared statementiterator
- the iterator to use for getting the parameter dataexpectedParams
- number of expected parametersSQLException
- is thrown if error populating parametersprotected boolean hasNamedParameters(String query)
protected static Object lookupParameter(String nextParam, org.apache.camel.Exchange exchange, Object body)
protected static boolean hasParameter(String nextParam, org.apache.camel.Exchange exchange, Object body)
protected static org.springframework.util.CompositeIterator createInParameterIterator(Object value)
Apache Camel