Skip to content

Fix callable statements with prepareMethod=none (#3070) - #3073

Merged
Divang Sharma (divang) merged 1 commit into
release/13.6from
user/divang/backport-3070-release-13.6
Oct 13, 2026
Merged

Divang Sharma (divang) merged 1 commit into
release/13.6from
user/divang/backport-3070-release-13.6

Conversation

@divang

@divang Divang Sharma (divang) commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #3070 (merged to main as ab0bc35) to release/13.6.

Problem
With prepareMethod=none, parameters of a stored procedure call (dates, times, timestamps, and decimals with
precision > 18 or scale > 6) were written as CAST(...) expressions. CAST is not valid in an EXEC argument list, so
the call failed.

Fix
Arguments of a procedure call are now written as plain literals. Parameters of other statements keep the typed form.

Backport notes

  • Cherry-picked cleanly (git cherry-pick -x), no conflicts, same patch as on main.
  • Files: SQLServerPreparedStatement.java and the new PrepareMethodNoneCallableStatementTest.java.
  • Tested on the release/13.6 branch against SQL Server: 153 tests passed (callable/prepared statement, direct SQL
    execution and temp table suites).
  • Does not include the 13.6.1 version bump or CHANGELOG entry.

Known limitations (same as #3070, documented there)

  • If a statement starts with EXEC, all its parameters are written as plain literals, so a later statement in the same
    text, such as EXEC proc; SELECT ?, returns a varchar instead of a typed date or decimal.

Render procedure arguments as EXEC-safe literals while preserving typed expression formatting. Add regression coverage for temporal, decimal, and unaffected parameter types.

---------
Co-authored-by: Divang Sharma <divangsharma@microsoft.com>

(cherry picked from commit ab0bc35)
@machavan Mahendra Chavan (machavan) added this to the 13.6.1 milestone Oct 13, 2026
@divang
Divang Sharma (divang) merged commit 818a9c6 into release/13.6 Oct 13, 2026
4 checks passed
@divang
Divang Sharma (divang) deleted the user/divang/backport-3070-release-13.6 branch October 13, 2026 08:18
@github-project-automation github-project-automation Bot moved this from In progress to Closed/Merged PRs in MSSQL JDBC Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed/Merged PRs

Development

Successfully merging this pull request may close these issues.

3 participants