fix(parser): #283 collect errors from all erroneous statements in multi-statement input#470
Open
liuxy0551 wants to merge 2 commits into
Open
fix(parser): #283 collect errors from all erroneous statements in multi-statement input#470liuxy0551 wants to merge 2 commits into
liuxy0551 wants to merge 2 commits into
Conversation
…for all dialects
… in multi-statement input
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.
简介
问题原因
当输入
SELEC * from table1; SELEC * from table2;时:简单来说:当 SQL 语句以拼写错误的关键词开头时,解析器根本不尝试解析后续语句,直接把后面所有内容都跳过了,所以只能报出一个错误。
修复方案
在
validate()方法中增加了一个"分而治之"的策略:这样做的好处是:
monaco-sql-languages 使用 dt-sql-parser@4.5.0-beta.3 即可预览效果,因此不再单独提供 PR 和预览地址。
遗留点
借助分号进行切分,如果 SQL 语句没有写分号,依旧会报一个错。没有分号的多条语句此时校验优先级不高,暂不处理。