[
https://issues.apache.org/jira/browse/CAMEL-24869?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-24869.
---------------------------------
Resolution: Fixed
> camel-jbang - validator hint for sql endpoint queries with :name parameters
> (camel-sql uses :#name)
> ---------------------------------------------------------------------------------------------------
>
> Key: CAMEL-24869
> URL: https://issues.apache.org/jira/browse/CAMEL-24869
> Project: Camel
> Issue Type: Improvement
> Components: camel-jbang, camel-yaml-dsl
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.23.0
>
>
> Found in the camel-jbang-mcp stepwise benchmark on the connect-service/sql
> example (H2): in 5 of 6 runs the local model's first insert used a parameter
> syntax that camel-sql does not have:
> {noformat}
> VALUES (:customer, :country, 1)
> VALUES (:body[customer], :body[country], 1)
> {noformat}
> camel-sql named parameters are {{:#name}} (looked up in headers, then a Map
> body) or {{:#${simple}}}; a bare {{:name}} goes to the JDBC driver as it is
> and fails at runtime with a syntax error, after the file consumer has retried
> it a hundred times. Nothing in the validator or the write tool says so, and
> the model's own knowledge is the Spring/JPA {{:name}} form.
> Add a validator row for {{sql}} and {{sql-stored}}/{{jdbc}} endpoint queries:
> a {{:name}} that is not {{:#name}}, {{:#${...}}}, {{:?name}} (stored
> procedure out parameter) or a {{::}} cast gets the hint "camel-sql named
> parameters are :#name (a header or a key of a Map body) or :#${simple}; use
> :#customer". The check is deterministic (a regex on the query option), so the
> write tool refuses the file with the corrected form before the app runs it.
> The dialect mistakes in the same runs (Postgres ON CONFLICT and MySQL ON
> DUPLICATE KEY UPDATE against H2) are not a validator matter; the sql tool of
> CAMEL-24867 lets a model try a statement against the actual database first.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)