forcedotcom / Salesforce-CDP-jdbc

JDBC driver to connect to Salesforce CDP.
Apache License 2.0
32 stars 28 forks source link

Indexes of parameters for prepared statements must be 1-based. #117

Open kool79 opened 1 year ago

kool79 commented 1 year ago

Method createSqlQuery in a QueryServicePreparedStatement class use 0-based indexes for prepared statements. But historically java uses 1-based indexes for prepared statements See examples and javadoc here: https://docs.oracle.com/en/java/javase/13/docs/api/java.sql/java/sql/PreparedStatement.html#setByte(int,byte)

Because of this issue all arguments are shifted and 1st argument is replaced by "null" value. Below you can see a screenshot of logs for project with iBatis framework: scr_2023_01_24T20_41_43

kool79 commented 1 year ago

This fix required to use this driver with another DB libraries which use PreparedStatements. For example, with MyBatis/iBatis