camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: how to execte jdbc IN clause statement
Date Sun, 23 Nov 2014 16:25:41 GMT
Hi

The IN is not supported. I am not sure how this would work out, as
then you can likely not use prepared statements, but have to fallback
to a standard SQL, and then build the query dynamic.

Then the IN should be expanded, as N1, N2, N3 etc.

So there is some work to do this, and also safely detect the IN, or
that the end user need to set some option to the SQL endpoint so it
knows its a IN and need special handling.

Or am I wrong about prepared statement not supporting IN with has
dynamic values easily?

On Sun, Nov 23, 2014 at 11:03 AM, chaituu <yarlagadda54@gmail.com> wrote:
> i have written custom prepared strategy,how to set parameter for ids' in
> update query
>
>
>
> public class CustomPrepareStatementStrategy extends
> org.apache.camel.component.jdbc.DefaultJdbcPrepareStatementStrategy {
>
>
>
>          private static final transient Logger LOG =
> Logger.getLogger(CustomPrepareStatementStrategy.class);
>
>         @Override
>         public Iterator<?> createPopulateIterator(String query,
>                         String preparedQuery, int expectedParams, Exchange exchange,
>                         Object value) throws SQLException {
>
>                 LOG.info(preparedQuery+"   preparedQuery:query:"+query);
>                 String body =exchange.getIn().getBody(String.class);
>                 String header= (String)exchange.getIn().getHeader("ids");
>                 LOG.info(header+"................body:"+body);
>
>                   return
> exchange.getContext().getTypeConverter().convertTo(Iterator.class, value);
>
>         }
>
>
>
> }
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/how-to-execte-jdbc-IN-clause-statement-tp5759495p5759506.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message