◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ sql grammar follows https://dev.mysql.com/doc/refman/5.7/en/select.html

## news

- Fix bug `using ' & " for column alias?` since v1.4.1 [#40](https://github.com/JavaScriptor/js-sql-parser/issues/40), [#44](https://github.com/JavaScriptor/js-sql-parser/issues/44)
- Fix bug tableFactor alias since v1.3.0 [#34](https://github.com/JavaScriptor/js-sql-parser/issues/34)
- Add support for "`" quoted alias since v1.2.2. [#33](https://github.com/JavaScriptor/js-sql-parser/issues/33)
Expand All @@ -35,6 +36,18 @@ console.log(parser.stringify(ast));
// SELECT foo FROM bar
```

## script tag

```js
Expand All @@ -60,10 +73,6 @@ var sql = sqlParser.stringify(ast);
- intervalexpr: Date INTERVAL keyword. // to support
- into outfile: INTO OUTFILE keyword. // to support

## TODO

- ${value} like value place holder support.

## Build

- Run `npm run build` to build the distributable.
Expand Down
2 changes: 1 addition & 1 deletion src/sqlParser.jison
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[#]\s.*\n /* skip sql comments */
\s+ /* skip whitespace */

[$][{](.*?)[}] return 'PLACE_HOLDER'
[`][a-zA-Z_\u4e00-\u9fa5][a-zA-Z0-9_\u4e00-\u9fa5]*[`] return 'IDENTIFIER'
[\w]+[\u4e00-\u9fa5]+[0-9a-zA-Z_\u4e00-\u9fa5]* return 'IDENTIFIER'
[\u4e00-\u9fa5][0-9a-zA-Z_\u4e00-\u9fa5]* return 'IDENTIFIER'
Expand Down
12 changes: 0 additions & 12 deletions src/stringify.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,18 +552,6 @@ Sql.prototype.travelSelectParenthesized = function(ast) {
this.appendKeyword(')');
};
Sql.prototype.travelPlaceHolder = function (ast) {
if (ast.left) {
this.travel(ast.left);
}

if (ast.operator) {
this.append(ast.operator);
}

if (ast.right) {
this.append(ast.right);
}

if (ast.value) {
this.travel(ast.value);
}
Expand Down
Toggle all file notes Toggle all file annotations