- Notifications
You must be signed in to change notification settings - Fork47
SQL(select) parser written with jison. parse SQL into abstract syntax tree(AST) and stringify back to SQL. sql grammar followshttps://dev.mysql.com/doc/refman/5.7/en/select.html
License
NotificationsYou must be signed in to change notification settings
JavaScriptor/js-sql-parser
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
parse / stringify sql (select grammar) in js.
sql grammar followshttps://dev.mysql.com/doc/refman/5.7/en/select.html
- Typo 'refrence' has been fixed to 'reference' since v1.2.0.
- Fix bug stringify keyword
having
since v1.2.1.#29 - Add support for "`" quoted alias since v1.2.2.#33
for more changes seeCHANGELOG
npm install --save js-sql-parser
constparser=require('js-sql-parser');constast=parser.parse('select * from dual');console.log(JSON.stringify(ast,null,2));ast.value.selectItems.value[0].value='foo';ast.value.from.value[0].value.value.value='bar';console.log(parser.stringify(ast));// SELECT foo FROM bar
<scriptsrc="./dist/parser/sqlParser.js"><script/>var sqlParser = window.sqlParser;var ast = sqlParser.parse('select * from dual');var sql = sqlParser.stringify(ast);
...
- Hexadecimal Literals as x'01af' X'01af', but 0x01af is supported.
- keyword COLLATE.
- parammarker: keyword PREPARE / EXECUTE / DEALLOCATE
- variable: keyword SET / CREATE PROCEDURE / CREATE FUNCTION
- identifier expr: ODBC escape syntax
- matchexpr: Full-Text Search Functions. // to support
- intervalexpr: Date INTERVAL keyword. // to support
- into outfile: INTO OUTFILE keyword. // to support
- ${value} like value place holder support.
- Run
npm run build
to build the distributable.
MIT
About
SQL(select) parser written with jison. parse SQL into abstract syntax tree(AST) and stringify back to SQL. sql grammar followshttps://dev.mysql.com/doc/refman/5.7/en/select.html
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors8
Uh oh!
There was an error while loading.Please reload this page.