Skip to content

SELECT's clauses in any order, and _TALLY - #10

Merged
RandomChirp merged 2 commits into
FoxDevCommunity:mainfrom
jefflroberts:select-clause-order
Sep 24, 2026
Merged

RandomChirp merged 2 commits into
FoxDevCommunity:mainfrom
jefflroberts:select-clause-order

Conversation

@jefflroberts

Copy link
Copy Markdown
Collaborator

Measured in Visual FoxPro 9, and written into the select_clause_order golden
whose .expected vfp9.exe produced: the clauses after the select list may come
in any order - Microsoft's own wbmain.prg writes INTO ARRAY ... ORDER BY name GROUP BY name, and a WHERE after INTO CURSOR, or an ORDER BY before WHERE,
is the same query written the usual way round. INTO CURSOR and INTO TABLE no
longer swallow the rest of the line, only their own option words.

_TALLY is set to the number of rows a SELECT answered with (it was never set);
wbmain.prg tests it straight after that query.

Builds on #2 (UNION is read by the same loop).

Verification. The select_clause_order golden, whose .expected vfp9.exe wrote. The full VM suite passes on this branch.

Depends on #2, whose UNION handling this reorganises: until #2 is merged this pull request's diff includes it too. Only the last commit is new here.

🤖 Generated with Claude Code

jefflroberts and others added 2 commits September 23, 2026 11:31
USE IN SELECT('alias'), ?name parameters in SELECT-SQL, INSERT INTO ... SELECT,
UNION [ALL], and a quoted name after DO and CREATE TABLE (with its NAME clause).
Every one was found in a 60,000-line CodeMine application, none of them rare
there, and each was measured in Visual FoxPro 9 before being written: ?name is
taken only by SELECT and is an ordinary expression, field first; INSERT ...
SELECT goes by position to the fields named; a UNION's columns are the first
SELECT's and its rows fold unless every UNION said ALL.

Two faults in the VM came out on the way and are fixed here because the new
forms could not be tested without them: a select list of nothing but `*` read
blank rows from a freshly opened table, since no field read had fetched the
page (SqlTouch now reads each starred source); and INTO ARRAY put the program
back in the last source's work area rather than its own, because the area was
noted after the sources were opened.

The sql_forms golden is written from the product. Two gaps it exposed are
recorded in the parity plan rather than fixed: a LOCAL shadows a field of the
same name here where the product reads the field, and _TALLY is never set.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Measured in Visual FoxPro 9, and written into the select_clause_order golden
whose .expected vfp9.exe produced: the clauses after the select list may come
in any order - Microsoft's own wbmain.prg writes `INTO ARRAY ... ORDER BY name
GROUP BY name`, and a WHERE after INTO CURSOR, or an ORDER BY before WHERE,
is the same query written the usual way round. INTO CURSOR and INTO TABLE no
longer swallow the rest of the line, only their own option words.

_TALLY is set to the number of rows a SELECT answered with (it was never set);
wbmain.prg tests it straight after that query.

Builds on FoxDevCommunity#2 (UNION is read by the same loop).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@RandomChirp RandomChirp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The clause loop reads the same query in any order, the golden select_clause_order.prg agrees with vfp9.exe, the UNION path keeps an INTO written before it, and cargo test -p foxvm is green on a merge with main (main already has #2, which this needed).

_TALLY is now set by SELECT; INSERT, UPDATE and DELETE still leave it at 0, which is where it was before this change, so that is a later PR, not this one.

The ubuntu check failed only on the stale instructions.json guard that main no longer has; a rebase clears it.

Review generated with Claude Code (Claude Fable 5.1), run against vfp9.exe and the test suites on a merge with main.

@RandomChirp
RandomChirp merged commit 045e515 into FoxDevCommunity:main Sep 24, 2026
2 of 3 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