fix(adt): a decimal-less numeric wider than int32 no longer reads back as 0 - #140
Merged
Merged
Conversation
…k as 0 adt_spec_for() mapped every DBF N(n,0) to ADS_INTEGER, a 4-byte int32 capped at 2,147,483,647. Anything wider was destroyed on the way in: an N(19,0) holding 5,000,000,000 came back as 0 -- not rounded, zero, and nothing anywhere signalled the loss. Real schemas reach past that ceiling without being unusual: a credit limit N(16,0) in a soft currency, or the N(19,0) money columns of a tax-reporting table carrying yearly totals. Narrow fields keep using INTEGER -- 9 digits top out at 999,999,999, which always fits, and the column stays half the size of a DOUBLE. Wider ones become DOUBLE, exact for integers up to 2^53 (~9.0e15). N(n,d) with d > 0 already mapped to DOUBLE and keeps storing 0 decimals in its field descriptor: that is what the real engine does, and stamping the Harbour decimals there made it reject the table as corrupt (7016). Suite 1194/1206: exactly the 12 pre-existing SQL-parser (7200) failures. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
FiveTechSoft
added a commit
that referenced
this pull request
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
adt_spec_for()maps every DBFN(n,0)toADS_INTEGER, a 4-byte int32 capped at 2,147,483,647. Anything wider is destroyed on the way in: anN(19,0)holding5000000000comes back as 0 — not rounded, zero, and nothing anywhere signals the loss.Real schemas reach past that ceiling without being unusual: a credit limit
N(16,0)in a soft currency, or theN(19,0)money columns of a tax-reporting table carrying yearly totals.Narrow fields keep using
INTEGER— 9 digits top out at 999,999,999, which always fits, and the column stays half the size of aDOUBLE. Wider ones becomeDOUBLE, exact for integers up to 2^53 (~9.0e15).N(n,d)withd > 0already mapped toDOUBLEand keeps storing 0 decimals in its field descriptor — that is what the real engine does, and stamping the Harbour decimals there made it reject the table as corrupt (7016). Unchanged here.Measured before/after on the same table, values read back after closing and reopening:
N(12,0)= 123456789012123456789012N(18,0)= 123456789012345678123456789012345700N(19,0)= 12345678901234567891234567890123457000New test
abi_adt_wide_numeric_test.cpppins both halves of the contract:N(9,0)must stayINTEGER, and the wider ones must round-trip values above the int32 ceiling.Suite: 1208/1226 — the 18 pre-existing failures of
origin/mainon this machine and nothing else, confirmed over three runs.