Package org.apache.camel.component.jdbc
Class DefaultJdbcPrepareStatementStrategy
- java.lang.Object
-
- org.apache.camel.component.jdbc.DefaultJdbcPrepareStatementStrategy
-
- All Implemented Interfaces:
JdbcPrepareStatementStrategy
public class DefaultJdbcPrepareStatementStrategy extends Object implements JdbcPrepareStatementStrategy
DefaultJdbcPrepareStatementStrategy
which is a copy from the camel-sql component having this functionality first.
-
-
Constructor Summary
Constructors Constructor Description DefaultJdbcPrepareStatementStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
void
populateStatement(PreparedStatement ps, Iterator<?> iterator, int expectedParams)
Populates the query parameters on the prepared statementString
prepareQuery(String query, boolean allowNamedParameters)
Prepares the query to be executed.
-
-
-
Method Detail
-
prepareQuery
public String prepareQuery(String query, boolean allowNamedParameters) throws SQLException
Description copied from interface:JdbcPrepareStatementStrategy
Prepares the query to be executed.- Specified by:
prepareQuery
in interfaceJdbcPrepareStatementStrategy
- Parameters:
query
- the query which may contain named query parametersallowNamedParameters
- whether named parameters is allowed- Returns:
- the query to actually use, which must be accepted by the JDBC driver.
- Throws:
SQLException
-
createPopulateIterator
public Iterator<?> createPopulateIterator(String query, String preparedQuery, int expectedParams, org.apache.camel.Exchange exchange, Object value) throws SQLException
Description copied from interface:JdbcPrepareStatementStrategy
Creates the iterator to use when setting query parameters on the prepared statement.- Specified by:
createPopulateIterator
in interfaceJdbcPrepareStatementStrategy
- Parameters:
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 parameters- Returns:
- the iterator
- Throws:
SQLException
- is thrown if error creating the iterator
-
populateStatement
public void populateStatement(PreparedStatement ps, Iterator<?> iterator, int expectedParams) throws SQLException
Description copied from interface:JdbcPrepareStatementStrategy
Populates the query parameters on the prepared statement- Specified by:
populateStatement
in interfaceJdbcPrepareStatementStrategy
- Parameters:
ps
- the prepared statementiterator
- the iterator to use for getting the parameter dataexpectedParams
- number of expected parameters- Throws:
SQLException
- is thrown if error populating parameters
-
hasNamedParameters
protected boolean hasNamedParameters(String query)
-
-