camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrea Cosentino (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAMEL-11716) error in handling return parameters in db functions
Date Tue, 29 Aug 2017 08:38:00 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-11716?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Andrea Cosentino updated CAMEL-11716:
-------------------------------------
    Fix Version/s: 2.19.3
                   2.20.0
                   2.18.5

> error in handling return parameters in db functions
> ---------------------------------------------------
>
>                 Key: CAMEL-11716
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11716
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-sql
>    Affects Versions: 2.19.1
>            Reporter: Andrea Tarocchi
>            Assignee: Andrea Cosentino
>             Fix For: 2.18.5, 2.20.0, 2.19.3
>
>
> Let's consider for instance the following db function:
> {code}
> create or replace function sum_two_numbers_function
>   (a in number, b in number)
> return number deterministic is
> begin
>  return a + b;
> end;
> {code}
> One might think to run this camel route in order to call the mentioned db function:
> {code}
> sql-store:sum_two_numbers_function(INTEGER ${body[0]}, INTEGER ${body[1]})?function=true
> {code}
> but SqlCall build incorect query:
> {code}
> ? = call sum_two_numbers_function(?)
> {code}
> which fail on wrong number of arguments. After an investigation is found out that first
parameter was skipped for function calls.
> https://github.com/spring-projects/spring-framework/blob/v4.3.3.RELEASE/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlCall.java#L135
> So one might try to add one parameter which should be used as output for return statement.
But the only valid format of parameter (for db functions) seems to be {{InputParameter}} which
is not possible to use as output for result.
> {code}
> sql-store:sum_two_numbers_function(INTEGER ${body[2]}, INTEGER ${body[0]}, INTEGER ${body[1]})?function=true
> {code}
> If {{OutputParameter}} are used than this https://github.com/apache/camel/blob/master/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/TemplateStoredProcedure.java#L77
will force to create SQL procedure call (instead of a function one), for instance this:
> {code}
> sql-store:sum_two_numbers_function(OUT INTEGER result, INTEGER ${body[0]}, INTEGER ${body[1]})?function=true
> {code}
> results in this query call:
> {code}
> call sum_two_numbers_function(?, ?, ?)
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message