coresql / sql-query-identifier

A SQL query identifier (e.g. INSERT, SELECT, CREATE TABLE, and etc.)
https://sqlectron.github.io/sql-query-identifier/
MIT License
33 stars 10 forks source link

Fix identifying queries with lowercase block openers #63

Closed MasterOdin closed 2 years ago

MasterOdin commented 2 years ago

PR fixes parsing queries that have a lowercase block opener as part of the query. Before, it would not detect the block opener (as it expects an upper case string for comparison), but we would properly detect the end for that block, and so would close out any currently in progress blocks, and then the next encountered semi-colon would close out the statement. For the test case, this would mean that we'd end up with three statements, with the SELECT 1 as its own statement, followed by the ; (where the END gets parsed into oblivion, see #62).