davsclaus opened a new pull request, #26672: URL: https://github.com/apache/camel/pull/26672
Fixes https://issues.apache.org/jira/browse/CAMEL-24869 A `:name` in a sql endpoint query that is not the camel-sql `:#name` (a header or a key of a Map body) or `:#${simple}` form goes to the JDBC driver as written and fails at runtime with a syntax error, after the file consumer retried it a hundred times. The validator (`camel validate`, `camel_validate_source`, `camel_write_file`) now names the parameter and says how to write it: ``` Line 8: sql: :customer is not a camel-sql named parameter (the JDBC driver gets it as written and fails with a syntax error): write :#customer for a header or a key of a Map body, or :#${body[customer]} with a Simple expression (also :country) ``` It covers the query under `parameters:` and the `sql:SELECT ...` path (the uri pattern stops at the first space, so the statement is taken from the line). `::type` casts, `:?name` stored procedure parameters, `:#...` and times such as `'10:30'` are left alone; `sql-stored` and `jdbc` are not checked (their statements have other forms). Seen in the camel-jbang-mcp server stepwise benchmark on the sql example: five of six first statements of the local model used `:customer` or `:body[customer]`. Tests: `SourceValidatorSqlParametersTest`; every documentation example still passes `CatalogDocExamplesTest`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Bp3538HRBPMQkb5ta9xRaj -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
