Skip to content
This repository was archived by the owner on Jul 15, 2021. It is now read-only.

Commit 10fdc52

Browse files
committed
new specs for WITH clause with recursive table expressions. added new methods in parser-util.js to reduce repeated code: keyify(), textMerge(), and listify(). fixed bind parameter rules and AST so that a named tcl parameter can still have an alias. changed the format for INSERT, WITH, and FOREIGN KEY when using a table name versus a table expression name with a column list. JOIN rules so that USING clause can be followed by column names enclosed in parenthesis as the previous rule was not the correct behavior. JOIN AST modified to have a constraint property, instead of on and using, as a join can only have one of these constraints at a time. many places in the AST that previously had a string value in the name property, such as the into property of an INSERT statement, now instead have a node of type identifier. FOREIGN KEY constraints now have a references property that contains an expression identifier or a table identifier depending on the query instead of the target, columns, and name properties. several property values are now being normalized to lowercased strings instead of being passed unmodified to the AST. for example, the action property of action node now contains a lowercased value. removed redundant rules that pointed to name rule, such as name_function, name_view, and name_trigger. unquoted identifiers are now normalized to lowercased strings as per the SQL-92 standard. quoted identifiers are not normalized. now preventing FOUC when first loading the demo page. also allowing cursor focus on Syntax Tree editor so that the contents can be selected and copied to the clipboard. refs #2
1 parent f4a4a48 commit 10fdc52

18 files changed

Lines changed: 4507 additions & 4866 deletions

CHANGELOG.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ All notable changes to this project will be documented in this file.
77
- rules and AST for missing SQLite-specific statement types: `PRAGMA`, `DETACH`, `VACUUM`, `ANALYZE`, and `REINDEX`
88
- new specs for SQLite-specific statement types
99
- new specs for missing transaction-related statement types
10-
- new spec for `WITH` clause with recursive table expressions
10+
- new specs for `WITH` clause with recursive table expressions
11+
- added new methods in `parser-util.js` to reduce repeated code: `keyify()`, `textMerge()`, and `listify()`
1112

1213
### Changed
1314
- fixed rules for `WITH` clause prepended to CRUD-type statements to make sure the `with` property is added to the correct nodes
@@ -39,6 +40,55 @@ All notable changes to this project will be documented in this file.
3940

4041
- `DROP` statement now gives correct `variant` to the `type:'identifier'` node in the `target` property
4142
- now, in a `ROLLBACK` statement, the savepoint exists on the `to` property
43+
- fixed bind parameter rules and AST so that a named tcl parameter can still have an alias
44+
- changed the format for `INSERT`, `WITH`, and `FOREIGN KEY` when using a table name versus a table expression name with a column list. for example, `INSERT INTO cats (a, b, c)` versus `INSERT INTO cats` now have the following differences in formats
45+
46+
``` json
47+
{
48+
"into": {
49+
"type": "identifier",
50+
"variant": "expression",
51+
"format": "table",
52+
"name": "cats",
53+
"columns": [
54+
{
55+
"type": "identifier",
56+
"variant": "column",
57+
"name": "a"
58+
},
59+
{
60+
"type": "identifier",
61+
"variant": "column",
62+
"name": "b"
63+
},
64+
{
65+
"type": "identifier",
66+
"variant": "column",
67+
"name": "c"
68+
}
69+
]
70+
}
71+
}
72+
```
73+
74+
``` json
75+
{
76+
"into": {
77+
"type": "identifier",
78+
"variant": "table",
79+
"name": "cats",
80+
}
81+
}
82+
```
83+
84+
- `JOIN` rules so that `USING` clause can be followed by column names enclosed in parenthesis as the previous rule was not the correct behavior
85+
- `JOIN` AST modified to have a `constraint` property, instead of `on` and `using`, as a join can only have one of these constraints at a time.
86+
- many places in the AST that previously had a string value in the `name` property, such as the `into` property of an `INSERT` statement, now instead have a node of `type` `'identifier'`
87+
- `FOREIGN KEY` constraints now have a `references` property that contains an `'expression'` identifier or a `'table'` identifier depending on the query instead of the `target`, `columns`, and `name` properties.
88+
- several property values are now being normalized to lowercased strings instead of being passed unmodified to the AST. for example, the `action` property of `action` node now contains a lowercased value.
89+
- removed redundant rules that pointed to `name` rule, such as `name_function`, `name_view`, and `name_trigger`.
90+
- unquoted identifiers are now normalized to lowercased strings as per the SQL-92 standard. quoted identifiers are not normalized.
91+
- now preventing FOUC when first loading the demo page. also allowing cursor focus on "Syntax Tree" editor so that the contents can be selected and copied to the clipboard.
4292

4393
## [v0.9.8] - 2015-07-06
4494
### Added

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ module.exports = function(grunt) {
9090
options: {
9191
failOnError: false
9292
},
93-
command: 'UGLY=true DEBUG=true ./node_modules/.bin/mocha test/index-spec.js --reporter="list"'
93+
command: 'UGLY=true DEBUG=true ./node_modules/.bin/mocha test/index-spec.js --colors --reporter="list"'
9494
}
9595
},
9696
connect: {

demo/css/sqlite-parser-demo.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<h2><a title="sqlite-parser on GitHub" href="https://github.com/codeschool/sqlite-parser/">sqlite-parser</a> demo</h2>
1717
</header>
1818

19-
<div class="container">
19+
<div id="container" class="shy">
2020

2121
<div class="left" id="sql">
2222
<h3 id="sql-header">SQL Statement</h3>

demo/js/sqlite-parser-demo.js

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sqlite-parser-min.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)