Skip to content

Fix incorrect index increment in SQL Server schema script parser#64

Open
prjanitor wants to merge 1 commit intoAvanade:mainfrom
prjanitor:prjanitor/c63a719e52de1789d9f5d904544fd78df6dd231e
Open

Fix incorrect index increment in SQL Server schema script parser#64
prjanitor wants to merge 1 commit intoAvanade:mainfrom
prjanitor:prjanitor/c63a719e52de1789d9f5d904544fd78df6dd231e

Conversation

@prjanitor
Copy link
Copy Markdown

Bug Description

The SQL Server schema script parser had a logic error where i = +2 was used instead of i += 2 when detecting 'OR ALTER' tokens in CREATE statements.

Impact

This caused the parser to incorrectly set the index to 2 instead of adding 2 to the current index, resulting in incorrect token parsing for statements like:

CREATE OR ALTER TABLE dbo.MyTable (...)

Fix

Changed the assignment operator from = to += to properly increment the index by 2, skipping past the 'OR ALTER' tokens.

Testing

The fix ensures that when parsing CREATE OR ALTER TYPE/VIEW/PROCEDURE statements, the parser correctly advances past the 'OR ALTER' tokens and properly extracts the object type and fully qualified name.


This PR was generated by PRJanitor — an automated tool that finds and fixes small bugs in open-source projects.

We respect your contribution guidelines — if your project doesn't accept bot PRs, we won't send more. You can also add a .github/prjanitor.yml file with enabled: false to opt out explicitly.

Changed 'i = +2' to 'i += 2' to properly skip past 'OR ALTER' tokens when parsing CREATE OR ALTER statements.
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.

1 participant