allthingssecurity commented on code in PR #27641:
URL: https://github.com/apache/camel/pull/27641#discussion_r4236646476


##########
components/camel-mybatis/src/main/java/org/apache/camel/component/mybatis/MyBatisProducer.java:
##########
@@ -297,6 +279,19 @@ public MyBatisEndpoint getEndpoint() {
         return (MyBatisEndpoint) super.getEndpoint();
     }
 
+    /**
+     * Iterates a collection, an iterator, a stream or an array of objects, to 
run the statement once per element. Any
+     * other value is one parameter as-is: a Map, a String (which may contain 
commas) and a primitive array (such as a
+     * byte[]).
+     */
+    private static Iterator<?> createIterator(Object in) {
+        if (in instanceof Map || in instanceof String
+                || (in.getClass().isArray() && 
in.getClass().getComponentType().isPrimitive())) {

Review Comment:
   Narrowed to `Map`/`String`/`byte[]` in 0109f2bd66 and updated the javadoc; 
`int[]`/`long[]` keep running once per element. Added a `byte[]` insert test 
(statement uses `#{array}`) and a `long[]` delete control test that fails if 
primitive arrays are passed whole.
   
   _Claude Code on behalf of allthingssecurity_



##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc:
##########
@@ -826,6 +826,14 @@ and most services, which were not registered at this level 
already). Prior to Ca
 every component. Use `RoutesOnly` (or `Default`) to keep the component MBeans. 
The CamelContext, health check and route
 controller MBeans are still registered.
 
+=== camel-mybatis - a String body is one parameter (Breaking change)
+
+With `statementType=Insert`, `Update` or `Delete`, a `String` body (or input 
header) is now passed to the statement as
+one parameter, also when it contains commas or is blank, and so is an array of 
a primitive type such as a `byte[]`.

Review Comment:
   Updated the upgrade-guide entry in 0109f2bd66: it now covers only `String` 
and `byte[]` (referred to as `#{array}`) and says that `int[]`, `long[]` and 
other arrays still run once per element.
   
   _Claude Code on behalf of allthingssecurity_



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