Skip to content

fix: numeric strings read decimal, money and smallmoney as exact text (#498) - #500

Merged
TimelordUK merged 1 commit into
masterfrom
fix/decimal-numeric-string
Oct 24, 2026
Merged

TimelordUK merged 1 commit into
masterfrom
fix/decimal-numeric-string

Conversation

@TimelordUK

Copy link
Copy Markdown
Owner

Part of #498: the second half of the fix. Prepared statements are still open, so this does not close the issue.

decimal is numeric under another name, but with numeric strings on it went through a double: it lost digits and gave different text from numeric ("5" against "5.00"). SQL_DECIMAL (decimal, money, smallmoney) now takes numeric's path, the driver's exact text, read by a new get_data_numeric_string. Both types also get the zero before the point that the driver leaves out.

with numeric strings on before after
decimal(38,2) 12345678901234567890.12 "12345678901234567000" "12345678901234567890.12"
decimal(19,0) 9007199254740993 "9007199254740992" "9007199254740993"
money 922337203685477.5807 "922337203685477.6" "922337203685477.5807"
decimal(5,2) 5 "5" "5.00"
numeric(5,2) -0.5 "-.50" "-0.50"
numeric(10,7) 0.0000001 ".0000001" "0.0000001"

Behaviour change, for the release notes: decimal keeps its scale, and numeric and decimal values below 1 get a leading zero. This applies only with numeric strings on.

Still open in #498: prepared statements bind numeric/decimal result columns as a double. Pinned as known-bug in corpus scripts/issue-498-prepared.

Tests: corpus scripts/issue-498 (agreed; the prepared case moved to its own script); unit tests for exact text, scale, leading zero and null; the setUseNumericString doc is updated. Full suite on Windows / ODBC 18: 1194 passing, 1 pending.

🤖 Generated with Claude Code

…, as numeric (#498)

decimal is numeric under another name, but under numeric strings it went through a double
(digits lost, "5" where numeric gives "5.00"). SQL_DECIMAL now takes numeric's path: the
driver's text, every digit and the scale. Both get the zero before the point the driver
leaves out ("-0.50", was "-.50").

Prepared statements still bind these columns as a double: corpus scripts/issue-498-prepared
pins it as known-bug. scripts/issue-498 is agreed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant