Skip to content

Fix sign and padding in string format for negative Numeric - #390

Closed
zuckschwerdt wants to merge 1 commit into
tiberius-rs:mainfrom
zuckschwerdt:fix-numeric2str
Closed

zuckschwerdt wants to merge 1 commit into
tiberius-rs:mainfrom
zuckschwerdt:fix-numeric2str

Conversation

@zuckschwerdt

Copy link
Copy Markdown
Contributor

This fixes the sign and padding problems in string format for negative Numerics.

  • The decimal part must not be negative when formatting to string, change to use .abs().
  • The integer part must have a "signed zero" when the value is negative, change to use .abs() and explicit sign.

I.e. before / after

  • Numeric(-123, 1) was "-12.-3" now is "-12.3"
  • Numeric(-123, 2) was "-1.-23" now is "-1.23"
  • Numeric(-123, 3) was "0.-123" now is "-0.123"
  • Numeric(-123, 4) was "0.-123" now is "-0.0123"

Fixes #368

MattJackson referenced this pull request in MattJackson/tiberius-ng Aug 29, 2026
- header.rs: allow(dead_code) on PacketHeader::sspi (platform/feature-gated use)
- connection.rs: drop needless reborrow in the zeroizing send path
- row.rs: elide lifetime on get_column_data
- rustfmt negative-numeric formatting from #390
MattJackson referenced this pull request in MattJackson/tiberius-ng Aug 29, 2026
…en_error

Raises coverage on pure-logic modules (collation mappings + accessors,
Numeric arithmetic/Display/round-trips, all date/time types incl. chrono
round-trips, Error Display/From, ToSql/IntoSql, token_error). Negative
Numeric Display asserts the #390-corrected single-sign output. No live DB.
MattJackson added a commit that referenced this pull request Sep 3, 2026
- header.rs: allow(dead_code) on PacketHeader::sspi (platform/feature-gated use)
- connection.rs: drop needless reborrow in the zeroizing send path
- row.rs: elide lifetime on get_column_data
- rustfmt negative-numeric formatting from #390

(cherry picked from commit 09079ca)
MattJackson added a commit that referenced this pull request Sep 4, 2026
- header.rs: allow(dead_code) on PacketHeader::sspi (platform/feature-gated use)
- connection.rs: drop needless reborrow in the zeroizing send path
- row.rs: elide lifetime on get_column_data
- rustfmt negative-numeric formatting from #390

(cherry picked from commit 09079ca)
MattJackson added a commit that referenced this pull request Sep 6, 2026
- header.rs: allow(dead_code) on PacketHeader::sspi (platform/feature-gated use)
- connection.rs: drop needless reborrow in the zeroizing send path
- row.rs: elide lifetime on get_column_data
- rustfmt negative-numeric formatting from #390

(cherry picked from commit 09079ca)
MattJackson added a commit that referenced this pull request Sep 15, 2026
- header.rs: allow(dead_code) on PacketHeader::sspi (platform/feature-gated use)
- connection.rs: drop needless reborrow in the zeroizing send path
- row.rs: elide lifetime on get_column_data
- rustfmt negative-numeric formatting from #390

(cherry picked from commit 09079ca)
MattJackson added a commit that referenced this pull request Sep 16, 2026
- header.rs: allow(dead_code) on PacketHeader::sspi (platform/feature-gated use)
- connection.rs: drop needless reborrow in the zeroizing send path
- row.rs: elide lifetime on get_column_data
- rustfmt negative-numeric formatting from #390

(cherry picked from commit 09079ca)
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.

Negative Numeric Floats sign issue

1 participant