[
https://issues.apache.org/jira/browse/CAMEL-10499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15683230#comment-15683230
]
ASF GitHub Bot commented on CAMEL-10499:
----------------------------------------
GitHub user igarashitm opened a pull request:
https://github.com/apache/camel/pull/1283
CAMEL-10499 camel-sql - error in multiple dynamic IN replacement
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/igarashitm/camel CAMEL-10499
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/camel/pull/1283.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1283
----
commit 21ce76b402117ea5e0fb621d1f95fb5e3d88a756
Author: Tomohisa Igarashi <[email protected]>
Date: 2016-11-21T10:56:19Z
CAMEL-10499 camel-sql - error in multiple dynamic IN replacement
----
> camel-sql - error in multiple dynamic IN replacement
> ----------------------------------------------------
>
> Key: CAMEL-10499
> URL: https://issues.apache.org/jira/browse/CAMEL-10499
> Project: Camel
> Issue Type: Bug
> Components: camel-sql
> Affects Versions: 2.18.0
> Reporter: Tomohisa Igarashi
> Assignee: Tomohisa Igarashi
> Fix For: 2.18.2, 2.19.0
>
>
> Having this sql
> {code:sql}
> select *
> from projects
> where project in (:#in:names)
> and license in (:#in:licenses)
> order by id
> {code}
> and send as following
> {code:java}
> Map<String, Object> headers = new HashMap<>();
> headers.put("names", new String[]{"Camel", "AMQ"});
> headers.put("licenses", new String[]{"ASF", "XXX", "YYY"});
> template.requestBodyAndHeaders("direct:query", "Hi there!", headers);
> {code}
> causes parameter mismatch
> {code}
> Caused by: java.sql.SQLException: Number of parameters mismatch. Expected: 4,
> was: 5
> at
> org.apache.camel.component.sql.DefaultSqlPrepareStatementStrategy.populateStatement(DefaultSqlPrepareStatementStrategy.java:152)
> ~[classes/:?]
> at
> org.apache.camel.component.sql.SqlProducer$2.doInPreparedStatement(SqlProducer.java:146)
> ~[classes/:?]
> at
> org.apache.camel.component.sql.SqlProducer$2.doInPreparedStatement(SqlProducer.java:116)
> ~[classes/:?]
> at
> org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)
> ~[spring-jdbc-4.3.4.RELEASE.jar:4.3.4.RELEASE]
> ... 51 more
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)