daiqiang commented on PR #37510:
URL: https://github.com/apache/shardingsphere/pull/37510#issuecomment-3692426176

   Thanks for your detailed review! I've updated the code based on your 
feedback, and here's the summary of changes & known constraints:
   
   #### 1. Narrowed the impact scope (addressed "all InputStream forced to 
setBlob" issue)
   - Only apply setBlob logic to **Oracle database** (judged by 
`DatabaseMetaData.getDatabaseProductName()`);
   - Non-Oracle databases retain the original `setObject` logic for all stream 
parameters (no behavior change).
   
   #### 2. Added length parameter for setBlob (addressed "missing length" issue)
   - Prioritize calling `setBlob(index, stream, length)` when length is 
available;
   - For `ByteArrayInputStream`, auto get length via `available()`;
   - Fallback to `setBlob(index, stream)` if length is unavailable.
   
   #### 3. Known constraint (ojdbc6 limitation)
   Due to ojdbc6's incomplete JDBC compliance:
   - `ParameterMetaData.getParameterTypeName()`/`getParameterType()` throw 
`SQLFeatureNotSupportedException` (ojdbc6's known issue);
   - Cannot judge whether the parameter is a BLOB column, so all Oracle 
InputStream parameters (even non-BLOB streams) will use setBlob temporarily.
   - Mitigation: Added fallback logic — if `setBlob` fails (throws 
SQLException), auto revert to original `setObject` to avoid new exceptions.
   
   #### 4. Test case explanation
   - Verified the fix in my local project (ShardingSphere 5.5.1 + Oracle + 
ojdbc6): Insert BLOB with InputStream no longer throws "Invalid column type";
   - Cannot add official test cases to master branch (5.5.3-SNAPSHOT) for 2 
reasons:
     1. I'm not familiar with the test structure of ShardingSphere-JDBC (could 
you provide guidance/docs about where to write Oracle-related test cases?);
     2. The master branch (5.5.3-SNAPSHOT) lacks Oracle-related parser code — 
basic Oracle CRUD cannot run normally (e.g., missing files in 
`parser->sql->engine->dialect->oracle`), making it impossible to run Oracle 
tests.
   
   #### 5. Impact scope confirmation
   - Non-Oracle databases: 100% retain original logic (no impact);
   - Oracle databases: Only InputStream parameters use setBlob (with fallback 
to setObject on failure), other parameter types remain unchanged.
   
   Looking forward to your further feedback! If there's any way to mitigate the 
ojdbc6 limitation (e.g., alternative ways to judge BLOB columns), I'm happy to 
adjust the code.


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