feat: add INSERT statement parsing with host variable bindings#2846
Open
allieseb wants to merge 9 commits intoTypeCobolTeam:developfrom
Open
feat: add INSERT statement parsing with host variable bindings#2846allieseb wants to merge 9 commits intoTypeCobolTeam:developfrom
allieseb wants to merge 9 commits intoTypeCobolTeam:developfrom
Conversation
…very Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… infrastructure Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- New test file with INSERT, UPDATE, DELETE, DECLARE CURSOR, OPEN, FETCH, CLOSE - All 7 unsupported statements parse without errors (catch-all rule works) - Updated expected results for ExecInDataDivision and ExecSqlWithCommit Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The unsupportedSqlStatement rule now matches any SQL tokens until END-EXEC instead of a closed list of 7 keywords. This handles all current and future SQL statements (GRANT, REVOKE, MERGE, CALL, CREATE INDEX, etc.) without requiring grammar updates for each new unsupported keyword. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ent set Replace the arbitrary SQL keyword list in unsupportedSqlStatement with a systematic set derived from the DB2 z/OS SQL Reference. The new unsupportedSqlKeyword rule lists all 26 statement-starting keywords that don't have a dedicated parser rule, with documentation of which SQL statements they cover. This eliminates the need to guess which keywords to add — when a new dedicated rule is created, its keyword is simply removed from this list. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add structured parsing for SQL INSERT statements in embedded COBOL SQL. Introduces HostVariableBinding shared class for column-to-variable mapping. - New InsertStatement CodeElement with TableName, Columns, HostVariables, HasSubselect - New Insert AST node (GenericNode<InsertStatement>) - ANTLR grammar rule: insertStatement with insertColumnList - Remove SQL_INSERT from unsupportedSqlStatement catch-all - Full infrastructure: enum, visitor, CUP terminal/production, builder, dispatcher, listener - SqlCodeElementBuilder.CreateInsertStatement() with helper methods - Test: 4 INSERT scenarios (VALUES, schema-qualified, subselect, no column list) - Updated UnsupportedSqlStatement test expected output Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
e1d4156 to
2bdcf9c
Compare
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.
Summary
INSERTstatements in embedded COBOL SQL blocksHostVariableBindingclass for column-to-host-variable mapping (reused by later DML PRs)InsertStatementCodeElement with TableName, Columns, HostVariables, HasSubselect propertiesDepends on #2845
Test plan
ExecSqlWithInsertStatement.rdz.cblwith 4 INSERT scenarios (VALUES, schema-qualified, subselect, no column list)ExecSqlWithUnsupportedStatementexpected output (INSERT no longer unsupported)🤖 Generated with Claude Code