Skip to content

SQLRDD: revert descending-order scope change from #2112 (ADS/DBFCDX keep keys from bottom up) - #2116

Merged
RobertvanderHulst merged 1 commit into
X-Sharp:devfrom
ecosSystem:homebase/sqlrdd-desc-scope-revert
Oct 24, 2026
Merged

RobertvanderHulst merged 1 commit into
X-Sharp:devfrom
ecosSystem:homebase/sqlrdd-desc-scope-revert

Conversation

@ecosSystem

@ecosSystem ecosSystem commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Reverts the second part of #2112 ("treat scopes on descending orders as key ranges"). The DTOS() part of #2112 is correct and stays.

Why

My premise in #2112 was wrong. I read the TopScopeNo/BottomScopeNo swap in CdxTag as "scopes are a key range [top..bottom] on descending tags" without testing it. Measured on the same DBF/CDX file (tag HDR_NR+DTOS(DATUM), descending), both AXDBFCDX (ADS local) and X# DBFCDX return:

scope AXDBFCDX DBFCDX
top 0000000005, bottom 000000000520261021 2 rows (22.10., 21.10.) 2 rows (22.10., 21.10.)
top 0000000005, bottom 000000000520261023 0 rows 0 rows

So on a descending tag only the keys from the bottom value upwards are returned, not the keys between the two values. That is exactly what SQLRDD did before #2112. The change in #2112 made SQLRDD differ from both DBF RDDs.

The application bug that led me there (a return of 0 in a fund evaluation) was caused by a field comparison in the application itself, not by the scopes. I am sorry for the noise.

Change

Revert of the SQLDbOrder.prg part of #2112: GetScopeClause() again builds both bounds through RangeExpression(), which applies the direction of the order.

Test plan

  • SQL Server via SQLRDD, test table with the same tag definition (hdr_nr+dtos(datum), descending): after the revert the descending-order scope again returns only the keys from the bottom value upwards, as AXDBFCDX/DBFCDX do
  • Repro suite (GoCold/RECNO/DTOS/scope cases): 9/9 pass, scope case now asserts the measured ADS/DBFCDX result
  • SQLRDD builds
  • Application: fund evaluation computes the same returns on SQL Server and on DBF/ADS
  • Runtime is not built by CI

🤖 Generated with Claude Code

… DBFCDX"

This reverts commit 06a2a93. The premise was wrong: tested against the
same DBF/CDX file, both ADS (AXDBFCDX) and X#'s DBFCDX return, for a
descending tag with TOPSCOPE "A" and BOTTOMSCOPE "A20261023", only the keys
from the bottom value upwards - exactly what SQLRDD did before. The reverted
change made SQLRDD return the keys between the two values instead, which is
not ADS compatible.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RobertvanderHulst
RobertvanderHulst merged commit 9e73ed5 into X-Sharp:dev Oct 24, 2026
2 checks passed
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.

2 participants