ammachado opened a new pull request, #31304:
URL: https://github.com/apache/camel/pull/31304

   # Description
   
   Fixes the five camel-sql problems listed in 
[CAMEL-27893](https://issues.apache.org/jira/browse/CAMEL-27893), found while 
documenting the options in CAMEL-23832 (#31159). The option descriptions 
written there documented the bugs; they now describe the fixed behavior.
   
   1. **Endpoint `usePlaceholder` had no effect on the URI query and the 
onConsume queries.** `SqlComponent.createEndpoint` replaced the placeholder 
with the component's `usePlaceholder` before `setProperties` ran. The 
replacement now runs after `setProperties`, with the endpoint's 
`usePlaceholder` and `placeholder`.
   2. **The consumer overrode `template.maxRows`.** 
`SqlConsumer.setMaxMessagesPerPoll` set `maxMessagesPerPoll` (0 by default) as 
the template's `maxRows`. It now only does so when `maxMessagesPerPoll > 0`.
   3. **sql-stored with `batch=true` evaluated `${...}` on the whole 
exchange,** so every item got the same value. 
`CallableStatementWrapper.addBatch` now evaluates on a copy of the exchange 
with the batch item as body, as `SqlHelper.lookupParameter` already does for 
`sql`.
   4. **`outputHeader` was set to null when there is no result** (an update, or 
`batch=true`). It is now only set when there is a result. `SelectOne` without a 
row still sets it to null, like the body.
   5. **Generated keys were not read with `outputType=StreamList`.** 
`processStreamList` now fills `CamelSqlGeneratedKeyRows` and 
`CamelSqlGeneratedKeysRowCount` like the other output types. Reading the keys 
was chosen over rejecting the header.
   
   Items 1, 3 and 4 change visible behavior, so the 4.25 upgrade guide has an 
entry for all five. The component pages, header/option descriptions, component 
JSON, catalog copies and endpoint/component DSL are updated 
(`./etc/scripts/regen.sh` leaves the tree clean).
   
   **Tests:** `SqlComponentUsePlaceholderTest` and 
`SqlConsumerTemplateMaxRowsTest` (new), plus new cases in 
`SqlProducerOutputHeaderTest`, `SqlGeneratedKeysTest` and 
`CallableStatementWrapperTest`. Each new test was confirmed to fail with the 
production change reverted. The camel-sql module run passes 422 of 424 tests; 
the 2 errors are `SqlFunctionDataSourceTest`, whose embedded MariaDB4j binary 
cannot load Homebrew `openssl@3` on my machine (unrelated to this change), so 
CI is its first real run.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   
   - [x] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
   
   (Built `components/camel-sql`, `dsl/camel-endpointdsl` and 
`dsl/camel-componentdsl`, then ran `./etc/scripts/regen.sh`; `git status` is 
clean afterwards.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code) on behalf of 
Adriano Machado (@ammachado)
   
   _This was generated by an AI agent and may contain inaccuracies. Please 
verify before relying on it._


-- 
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]

Reply via email to