public class DefaultJdbcPrepareStatementStrategy extends java.lang.Object implements JdbcPrepareStatementStrategy
JdbcPrepareStatementStrategy
which is a copy from the camel-sql component having
this functionality first.Constructor and Description |
---|
DefaultJdbcPrepareStatementStrategy() |
Modifier and Type | Method and Description |
---|---|
java.util.Iterator<?> |
createPopulateIterator(java.lang.String query,
java.lang.String preparedQuery,
int expectedParams,
Exchange exchange,
java.lang.Object value)
Creates the iterator to use when setting query parameters on the prepared statement.
|
protected boolean |
hasNamedParameters(java.lang.String query) |
void |
populateStatement(java.sql.PreparedStatement ps,
java.util.Iterator<?> iterator,
int expectedParams)
Populates the query parameters on the prepared statement
|
java.lang.String |
prepareQuery(java.lang.String query,
boolean allowNamedParameters)
Prepares the query to be executed.
|
public java.lang.String prepareQuery(java.lang.String query, boolean allowNamedParameters) throws java.sql.SQLException
JdbcPrepareStatementStrategy
prepareQuery
in interface JdbcPrepareStatementStrategy
query
- the query which may contain named query parametersallowNamedParameters
- whether named parameters is allowedjava.sql.SQLException
public java.util.Iterator<?> createPopulateIterator(java.lang.String query, java.lang.String preparedQuery, int expectedParams, Exchange exchange, java.lang.Object value) throws java.sql.SQLException
JdbcPrepareStatementStrategy
createPopulateIterator
in interface JdbcPrepareStatementStrategy
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 parametersjava.sql.SQLException
- is thrown if error creating the iteratorpublic void populateStatement(java.sql.PreparedStatement ps, java.util.Iterator<?> iterator, int expectedParams) throws java.sql.SQLException
JdbcPrepareStatementStrategy
populateStatement
in interface JdbcPrepareStatementStrategy
ps
- the prepared statementiterator
- the iterator to use for getting the parameter dataexpectedParams
- number of expected parametersjava.sql.SQLException
- is thrown if error populating parametersprotected boolean hasNamedParameters(java.lang.String query)
Copyright © 2007-2014 Red Hat, Inc.. All Rights Reserved.