forcedotcom / forcedotcom/Salesforce-CDP-jdbc

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

Open
#117 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
41
Forks
29
PR merge metrics
No merged PRs in 30d

Description

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](https://user-images.githubusercontent.com/4625317/214383878-4038a7c9-bedc-4063-b06e-1380b22ba6e9.png)

Contributor guide

No contributing guide indexed for this repository

Research direction

Locate the QueryServicePreparedStatement class and inspect its createSqlQuery method, focusing on how parameter indexes are assigned for prepared statements. Verify the change against the Java PreparedStatement documentation and confirm that the first argument is preserved rather than replaced with null and that subsequent arguments are not shifted.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.