Repository navigation
Implement BREAK and CONTINUE statements for WHILE loops with SQL-99 LEAVE/ITERATE support - #2263
Merged
Merged
Conversation
…nsive tests Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add BREAK and CONTINUE statements with reliable WHILE statement
Implement BREAK and CONTINUE statements for WHILE loops
Nov 20, 2025
mathiasrw
reviewed
Nov 30, 2025
mathiasrw
requested changes
Nov 30, 2025
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
Member
Could we support both? Its important that we work towards SQL99 compatibility. |
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
Contributor
Author
Added SQL-99 Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
Implement BREAK and CONTINUE statements for WHILE loops
Implement BREAK and CONTINUE statements for WHILE loops with SQL-99 LEAVE/ITERATE support
Nov 30, 2025
mathiasrw
approved these changes
Nov 30, 2025
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.
Thank you for the time you are putting into AlaSQL!
Adds control flow statements BREAK and CONTINUE to exit or skip iterations in WHILE loops, supporting both T-SQL and SQL-99 syntax.
Changes
BreakExceptionandContinueExceptionusing a helper functioncreateControlFlowException()for cleaner codeWhile.prototype.executeto handle control flow exceptions - catchesBreakExceptionto exit the loop andContinueExceptionto skip to the next iterationExample (T-SQL syntax)
Example (SQL-99 syntax)
Exceptions propagate through nested BEGIN...END blocks correctly. Test suite (
test/test37.js) covers 14 tests including simple loops, nested blocks, edge cases, and SQL-99 LEAVE/ITERATE aliases.Notes
SQL-99 compatibility: Both T-SQL (BREAK/CONTINUE) and SQL-99 (LEAVE/ITERATE) keywords are now supported. This maintains backward compatibility while working towards SQL-99 compliance.
File organization: The file header was corrected from "CREATE VIEW" to accurately reflect the WHILE/BREAK/CONTINUE/BeginEnd content. The code was already in this file before these changes.
Fixes Add BREAK and CONTINUE statements with more reliable WHILE statement #37
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.