Skip to content

det SQL: FETCH BEFORE | AFTER of a SCROLL cursor parks the position, no row (Part of #4269) - #7148

Merged
squid-shepherd[bot] merged 2 commits into
mainfrom
churn/4269-20261030T1308Z
Oct 30, 2026
Merged

squid-shepherd[bot] merged 2 commits into
mainfrom
churn/4269-20261030T1308Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Part of #4269 (COBOL translator: embedded SQL breadth). EXEC SQL FETCH [INSENSITIVE] BEFORE | AFTER [FROM] cursor on a SCROLL cursor was refused by name. The det port now models it: DetSql.positionScroll parks the cursor before its first row (POS 0) or after its last (POS n+1), SQLCODE 0, no host variable touched, no repository method (no row is read). A closed cursor gives -501/24501 as for the other FETCH forms.

Still refused by name (register Q4): BEFORE/AFTER with an INTO, on a cursor not declared SCROLL, on a SENSITIVE or DYNAMIC cursor, or WITH HOLD.

Changes

  • det/sql.py: _fetch_position emits the call; _refuse_scroll_and_rowset swaps the blanket refusal for the narrower ones above.
  • DetSql.java: positionScroll, rule RT-SQL-SCROLL-POSITION (also in cobolrt_rules.json).
  • register/Q4.md: modelled in the port, not yet proven on Db2.
  • test_sql_dynamic.py: JDK trace through BEFORE/AFTER, closed and empty cursors; codegen and refusal tests (batch and CICS).

Evidence level

Translated and executed on the JDK against the port's own model only. Not executed-equivalent against Db2: the oracle (ggsql.c, equivalence_sql.py) still refuses the statement, so nothing here is claimed as proven. The Db2 E2E tests (EQUIVALENCE_E2E=1) were skipped locally (no Docker).

Gates

pr_gates --fast --ratchets all pass, audit_check.py clear, 266 tree-wide guard tests pass, test_sql_dynamic.py 143 passed / 4 skipped (the Docker E2E ones). det_port.py check: 82 of 182 ports list as changed, every one for the same single file, cobolrt/sql/DetSql.java (+22 lines, the new positionScroll method, which none of them calls). No translated output changed. I did not re-prove those 82 (Db2 ports need Docker, unavailable here); a reviewer who wants them re-proven runs the det_port.py run line check prints.

Class / Sibling gaps

Class: scroll-cursor FETCH forms that only move the position and read no row. Done here: BEFORE, AFTER. Sibling gaps, each still refused by name: FETCH ROWSET with STARTING AT or an orientation; INSERT NOT ATOMIC CONTINUE ON SQLEXCEPTION; ATOMIC undo on a mid-rowset failure; SENSITIVE and DYNAMIC scroll cursors; scroll cursors WITH HOLD across COMMIT.

Remaining slices

Cross-repo

None: no companion PR in another repo.

🤖 Generated with Claude Code

@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 30, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review October 30, 2026 13:43
@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) October 30, 2026 13:43
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-shepherd
squid-shepherd Bot merged commit 67040b9 into main Oct 30, 2026
98 checks passed
@squid-shepherd
squid-shepherd Bot deleted the churn/4269-20261030T1308Z branch October 30, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant