Describe the bug
When the supportManyParameters flag is set, question marks in non-parameter locations (comments, string literals, etc.) are incorrectly interpreted as parameters. This section of code literally just finds /any/ occurrence of ? and splits the string. https://github.com/databricks/databricks-jdbc/blob/main/src/main/java/com/databricks/jdbc/common/util/SQLInterpolator.java#L68-L108
To Reproduce
Steps to reproduce the behavior:
Create a prepared statement like:
-- does this work?
select 'hello?', * from mytable where id = ?
Pass in the expected 1 parameter.
Get this error:
Parameter count does not match. Provide equal number of parameters as placeholders.
Expected behavior
Interpolation should properly check only real parameters, not those in comments or literals.
Screenshots
If applicable, add screenshots to help explain your problem.
Client side logs
If available, share redacted client side logs
Client Environment (please complete the following information):
- OS: [e.g. Windows]: N/A
- Java version [e.g. Java 21]: N/A
- Java vendor [e.g. OpenJDK]: N/A
- Driver Version [e.g. 3.1.1]: 3.2.1
- BI Tool (if used) [e.g. DBeaver]: N/A
- BI Tool version (if applicable) [e.g. 24.3.5]: N/A
Additional context
Add any other context about the problem here.
Describe the bug
When the
supportManyParametersflag is set, question marks in non-parameter locations (comments, string literals, etc.) are incorrectly interpreted as parameters. This section of code literally just finds /any/ occurrence of?and splits the string. https://github.com/databricks/databricks-jdbc/blob/main/src/main/java/com/databricks/jdbc/common/util/SQLInterpolator.java#L68-L108To Reproduce
Steps to reproduce the behavior:
Create a prepared statement like:
Pass in the expected 1 parameter.
Get this error:
Parameter count does not match. Provide equal number of parameters as placeholders.
Expected behavior
Interpolation should properly check only real parameters, not those in comments or literals.
Screenshots
If applicable, add screenshots to help explain your problem.
Client side logs
If available, share redacted client side logs
Client Environment (please complete the following information):
Additional context
Add any other context about the problem here.