John Taylor created CAMEL-18797:
-----------------------------------
Summary: camel-sql - Conditionally execute
ps.getParameterMetaData() in SqlProducer populateStatement
Key: CAMEL-18797
URL: https://issues.apache.org/jira/browse/CAMEL-18797
Project: Camel
Issue Type: Improvement
Components: camel-sql
Affects Versions: 3.19.0, 3.18.4
Environment: Windows 10
Karaf 4.4.2
OpenJDK 64-Bit Server VM version 11.0.13+8
Camel 3.18.4
Reporter: John Taylor
Fix For: 3.18.5, 3.19.0
Attachments: patchfile.txt
I have a similar problem to the CAMEL-18399 but instead of the result of
getParameterMetadata returning null it is throwing an exception from the
driver. The driver is com.microsoft.sqlserver/mssql-jdbc/11.2.1.jre11 although
all version are affected as far as I can tell. It looks like a bug in their
parser where it fails to parse for valid queries when there are parameters.
Where it affects me the most is when sql-92 join syntax includes a parameter,
like
{{select 'x' from TABLEA A JOIN TABLEB B on A.F1 = B.F1 and B.F2 = :#parm1
WHERE A.F1 = :#parm2}}
Including the parametersCount option doesn't help in this case as it doesn't
bypass the getParameterMetadata. My proposal is to only call
getParameterMetadata if the parametersCount isn't set because it is only being
used to populate the expected variable anyway.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)