Claus Ibsen created CAMEL-26148:
-----------------------------------

             Summary: camel-sql - sql-stored with batch=true reports a negative 
update count, and a single Map body fails with an unclear SQLException
                 Key: CAMEL-26148
                 URL: https://issues.apache.org/jira/browse/CAMEL-26148
             Project: Camel
          Issue Type: Bug
          Components: camel-sql
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of sql-stored (CAMEL-24961, PR 
#28393).

h4. 1. With batch=true, CamelSqlStoredUpdateCount can be negative

{{SqlStoredProducer}} (main 2a465aa4814c, lines 75-80) sums the counts returned 
by {{executeBatch}} into {{CamelSqlStoredUpdateCount}}. A driver may return 
{{Statement.SUCCESS_NO_INFO}} (-2) for each item, so a batch of 2 items reports 
-4. Checked on 4.24.0-SNAPSHOT with HSQLDB stored procedures.

Proposed: do not add SUCCESS_NO_INFO (or other negative) values to the total, 
and document what the header means then.

h4. 2. With batch=true, a single Map body iterates the map entries

{{SqlStoredProducer}} (main 2a465aa4814c, line 53) gets the batch items with 
{{getBody(Iterator.class)}}. A single Map body is turned into an iterator of 
its entries, so each entry is used as a batch item and the call fails with an 
SQLException that does not point to the body. Checked on 4.24.0-SNAPSHOT with 
HSQLDB stored procedures.

Proposed: treat a single Map body as one batch item, or fail with a message 
that batch=true expects a List or Iterator of Maps.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to