You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Router <ro...@trash-mail.com> on 2014/10/27 11:46:57 UTC

Re: Using named query parameters

Is it a bug?

Under http://camel.apache.org/sql-example.html  at the very bottom it says:

Notice in the SQL queries below we use named parameters which must start
with prefix ':#' and then the name, eg :#amount. Then Camel will bind that
parameter with the given name, from the
message body (if its a java.util.Map) or from a message header with the
name. *If none parameter could be found, Camel throws an exception.
*

If I set a wrong parameter in the sql.properties I don't get any exception:

sql.insertPosition=insert into mydb.test (col1) values ('*:#DoesNotExist*') 





--
View this message in context: http://camel.465427.n5.nabble.com/Using-named-query-parameters-tp5758002p5758080.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using named query parameters

Posted by Ettoregia <et...@gmail.com>.
Hi There,

in my case works but I had to escape the : and #, see the example below

INSERT INTO "ORDER" (name, status, \"processID\") VALUES(\:\#name,
\:\#status, \:\#processID)



--
View this message in context: http://camel.465427.n5.nabble.com/Using-named-query-parameters-tp5758002p5761770.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using named query parameters

Posted by Henryk Konsek <he...@gmail.com>.
Hi,

> I'm still not sure if the way I'm trying to access the java.util.Map
> resultset with :#Position is the right way. It seems that nobody is using
> this feature at all (at least I cannot find any other samples on the
> internet).

If it is documented, then it is supposed to work. :) If you can
reproduce the issue, then it is a good candidate to bug report.

Cheers.

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com

Re: Using named query parameters

Posted by Router <ro...@trash-mail.com>.
Hi Claus,


I'm still not sure if the way I'm trying to access the java.util.Map
resultset with :#Position is the right way. It seems that nobody is using
this feature at all (at least I cannot find any other samples on the
internet).



--
View this message in context: http://camel.465427.n5.nabble.com/Using-named-query-parameters-tp5758002p5758091.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using named query parameters

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah sounds like we should validate in camel that the key exists. You
are welcome to log a JIRA ticket
http://camel.apache.org/support



On Mon, Oct 27, 2014 at 11:46 AM, Router <ro...@trash-mail.com> wrote:
> Is it a bug?
>
> Under http://camel.apache.org/sql-example.html  at the very bottom it says:
>
> Notice in the SQL queries below we use named parameters which must start
> with prefix ':#' and then the name, eg :#amount. Then Camel will bind that
> parameter with the given name, from the
> message body (if its a java.util.Map) or from a message header with the
> name. *If none parameter could be found, Camel throws an exception.
> *
>
> If I set a wrong parameter in the sql.properties I don't get any exception:
>
> sql.insertPosition=insert into mydb.test (col1) values ('*:#DoesNotExist*')
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-named-query-parameters-tp5758002p5758080.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/