js-sql-parser
js-sql-parser copied to clipboard
SQL(select) parser written with jison. parse SQL into abstract syntax tree(AST) and stringify back to SQL. sql grammar follows https://dev.mysql.com/doc/refman/5.7/en/select.html
give the capability to parse query from a union select
Added support for the below functions ``` SELECT LEFT('SQL Tutorial', 3) AS ExtractString; SELECT RIGHT('SQL Tutorial', 3) AS ExtractString; ``` Earlier the parser was breaking as LEFT and RIGHT keywords...
LEFT(string, charcters length), RIGHT(string, characters length) not getting exact result as we expect instead throw error
See this as a TODO on the readme, just wanted to create an issue to track progress and so folks could +1 if desired. Thanks!
A little more coverage of sql queries would be very useful. ``` update TABLE_NAME set COLUMN_NAME=0 where ID_COLUMN=1 ```
This will not handle all versions of CAST but will handle a simple case like CAST(pct*100 AS int) The query mentioned in #9 was used as the test. ``` select...
If the sql string ends with a comment without a trailing newline it fails. This change make it handle this case. I included a test for this as well.
Implements parsing for INSERT and UPDATE queries, per the MySQL 5.7 grammar. Includes pretty printing + test cases. (Note: for my own purposes, I've published this branch under `@gpittarelli/js-sql-parser`)
This allows handling of the $-prefix (postgresql and sequelize bind), :-previx (PHP PDO and sequelize replace) and single ? (most DBS for prepared steatement. But this PR allows this placeholder...