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

Commit 96bacdd

Browse files
committed
version bump to v0.3.0 after AST changes. refs #2
1 parent 937076c commit 96bacdd

File tree

5 files changed

+88
-48
lines changed

5 files changed

+88
-48
lines changed

CHANGELOG.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,39 @@ All notable changes to this project will be documented in this file.
55

66
[unreleased]: https://github.com/codeschool/sqlite-parser
77

8+
## [v0.3.0] - 2015-06-25
9+
### Added
10+
- allow subquery in parenthesis within `FROM` clause
11+
12+
- New specs: Basic Drop Table, Basic Drop Trigger, Basic Function, Basic Subquery, Basic Union, Create Check 1, Create Check 2, Create Foreign Key 1, Create Foreign Key 2, Create Primary Key 1, Create Table Alt Syntax, Expression Like, Expression Table 1, Expression Unary 1, Function Mixed Args, Insert Into Default, Join Types 1, Join Types 2, Select Parts 1, Select Qualified Table 1, Transaction Rollback
13+
14+
# Changed
15+
- allow multiple expressions for `GROUP BY` clause
16+
17+
``` sql
18+
SELECT color, type, name
19+
FROM hats
20+
GROUP BY type, color
21+
```
22+
23+
- changed AST for create table, constraints, joins, select parts, transactions, unions, triggers to pass new specs
24+
- `INSERT` statement `VALUES` clause AST normalized for value lists and `DEFAULT VALUES`
25+
26+
``` json
27+
{
28+
"type": "values",
29+
"variant": "list",
30+
"values": []
31+
},
32+
{
33+
"type": "values",
34+
"variant": "default",
35+
"values": null
36+
}
37+
```
38+
39+
- normalized AST across all column constraints and table constraints. all table constraints are `{"type": "definition", "variant": "constraint"}` and contain a `definition` array that contains the constraint. the constraint in `definitions` has the same format as the column constraint definition.
40+
841
## [v0.2.3] - 2015-06-24
942
### Fixed
1043
- allow for nested parenthesis
@@ -109,7 +142,8 @@ All notable changes to this project will be documented in this file.
109142
### Added
110143
- First working version of sqlite-parser
111144

112-
[unreleased]: https://github.com/codeschool/sqlite-parser/compare/v0.2.3...HEAD
145+
[unreleased]: https://github.com/codeschool/sqlite-parser/compare/v0.3.0...HEAD
146+
[v0.3.0]: https://github.com/codeschool/sqlite-parser/compare/v0.2.3...v0.3.0
113147
[v0.2.3]: https://github.com/codeschool/sqlite-parser/compare/v0.2.2...v0.2.3
114148
[v0.2.2]: https://github.com/codeschool/sqlite-parser/compare/v0.2.1...v0.2.2
115149
[v0.2.1]: https://github.com/codeschool/sqlite-parser/compare/v0.2.0...v0.2.1

TODO.md

Lines changed: 48 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,27 @@
33
## **[1.0.0]** In progress
44

55
- [ ] Missing specs
6+
- [x] Basic Drop Table
7+
- [x] Basic Drop Trigger
8+
- [x] Basic Function
9+
- [x] Basic Subquery
10+
- [x] Basic Union
11+
- [x] Create Check 1
12+
- [x] Create Check 2
13+
- [x] Create Foreign Key 1
14+
- [x] Create Foreign Key 2
15+
- [x] Create Primary Key 1
16+
- [x] Create Table Alt Syntax
17+
- [x] Expression Like
18+
- [x] Expression Table 1
19+
- [x] Expression Unary 1
20+
- [x] Function Mixed Args
21+
- [x] Insert Into Default
22+
- [x] Join Types 1
23+
- [x] Join Types 2
24+
- [x] Select Parts 1
25+
- [x] Select Qualified Table 1
26+
- [x] Transaction Rollback
627

728
- [ ] Expression grouping issues
829
- [x] Grouping with unary and binary expressions
@@ -35,7 +56,7 @@
3556
NOT `happiness` OR ~`ANGER` AND `anger` IS NOT 0
3657
```
3758

38-
- [ ] Grouping with parenthesis
59+
- [x] Grouping with parenthesis
3960

4061
``` sql
4162
SELECT *
@@ -77,15 +98,15 @@
7798
) AS z
7899
```
79100

80-
- [ ] *Has spec*
101+
- [x] *Has spec*
81102
- [x] Functions `SUM()`, aggregation `*`, etc...
82103

83104
``` sql
84105
SELECT COUNT(*)
85106
FROM apples
86107
```
87108

88-
- [ ] *Has spec*
109+
- [x] *Has spec*
89110
- [x] Compound queries
90111

91112
``` sql
@@ -96,7 +117,7 @@
96117
FROM b
97118
```
98119

99-
- [ ] *Has spec*
120+
- [x] *Has spec*
100121

101122
- [x] Alternate syntax
102123

@@ -105,9 +126,11 @@
105126
ORDER BY id DESC
106127
```
107128

129+
- [x] *Has spec*
130+
108131
- [x] `JOIN` types `INNER`, `OUTER`, `LEFT` **TODO: Need tests**
109132
- [x] Joins on tables and/or sub-queries
110-
- [ ] *Has spec*
133+
- [x] *Has spec*
111134
- [x] `USING`
112135

113136
``` sql
@@ -139,23 +162,23 @@
139162
VALUES (1, 2, 'hey'), (2, 3, 'yo')
140163
```
141164

142-
- [ ] *Has spec*
165+
- [x] *Has spec*
143166
- [x] Default values
144167

145168
``` sql
146169
INSERT INTO apples (a, b, c)
147170
DEFAULT VALUES
148171
```
149172

150-
- [ ] *Has spec*
173+
- [x] *Has spec*
151174
- [x] Insert into select
152175

153176
``` sql
154177
INSERT INTO apples (a, b, c)
155178
SELECT * FROM apples
156179
```
157180

158-
- [ ] *Has spec*
181+
- [x] *Has spec*
159182
- [x] `UPDATE`
160183
- [x] Basic format
161184
- [x] *Has spec*
@@ -167,33 +190,33 @@
167190
- [x] Limit update format
168191
- [x] *Has spec*
169192
- [x] `DROP`
170-
- [ ] *Has spec*
193+
- [x] *Has spec*
171194
- [x] `CREATE`
172195
- [x] Table format
173196
- [x] Basic format
174197
- [x] *Has spec*
175198
- [x] Table constraints **TODO: Need tests**
176199
- [x] `PRIMARY KEY`
177-
- [ ] *Has spec*
200+
- [x] *Has spec*
178201
- [x] `CHECK`
179-
- [ ] *Has spec*
202+
- [x] *Has spec*
180203
- [x] `FOREIGN KEY`
181-
- [ ] *Has spec*
204+
- [x] *Has spec*
182205
- [x] Column constraints **TODO: Need tests**
183206
- [x] `PRIMARY KEY`
184-
- [ ] *Has spec*
207+
- [x] *Has spec*
185208
- [x] `NOT NULL`, `UNIQUE`
186-
- [ ] *Has spec*
209+
- [x] *Has spec*
187210
- [x] `CHECK`
188-
- [ ] *Has spec*
211+
- [x] *Has spec*
189212
- [x] `DEFAULT`
190213
- [ ] *Has spec*
191214
- [x] `COLLATE`
192215
- [ ] *Has spec*
193216
- [x] `FOREIGN KEY`
194-
- [ ] *Has spec*
217+
- [x] *Has spec*
195218
- [x] Create table `AS SELECT`
196-
- [ ] *Has spec*
219+
- [x] *Has spec*
197220
- [x] `ALTER TABLE` **TODO: Need tests**
198221
- [ ] *Has spec*
199222
- [x] Transaction statement types **TODO: Need tests**
@@ -220,7 +243,7 @@
220243
- [x] `COMMIT`, `END`
221244
- [x] *Has spec*
222245
- [x] `ROLLBACK`
223-
- [ ] *Has spec*
246+
- [x] *Has spec*
224247
- [x] Query plan `EXPLAIN QUERY PLAN stmt` **TODO: Need tests**
225248
- [ ] *Has spec*
226249
- [x] Multiple queries in batch
@@ -248,7 +271,7 @@
248271
FROM bees AS b INDEXED BY bees_index
249272
```
250273

251-
- [ ] *Has spec*
274+
- [x] *Has spec*
252275

253276
- [x] Comments
254277
- [x] Line comments
@@ -325,7 +348,7 @@
325348
FROM hats
326349
```
327350

328-
- [ ] *Has spec*
351+
- [x] *Has spec*
329352
- [x] `RAISE`
330353

331354
``` sql
@@ -348,7 +371,7 @@
348371
WHERE bees LIKE '%somebees%'
349372
```
350373

351-
- [ ] *Has spec*
374+
- [x] *Has spec*
352375
- [x] `ESCAPE`
353376

354377
``` sql
@@ -365,7 +388,7 @@
365388
WHERE ham IS NOT NULL
366389
```
367390

368-
- [ ] *Has spec*
391+
- [x] *Has spec*
369392
- [x] `BETWEEN`
370393

371394
``` sql
@@ -391,13 +414,13 @@
391414
WHERE 2 != 3
392415
```
393416

394-
- [ ] *Has spec*
417+
- [x] *Has spec*
395418
- [x] Functions
396419

397420
``` sql
398421
SELECT MYFUNC(col, 1.2, 'str')
399422
```
400-
- [ ] *Has spec*
423+
- [x] *Has spec*
401424
- [x] Table expressions
402425

403426
``` sql
@@ -411,8 +434,7 @@
411434
ON inventory.variety = ham.type
412435
```
413436

414-
- [ ] *Has spec*
415-
437+
- [x] *Has spec*
416438
- [x] Logical grouping `1 == 2 AND 2 == 3`
417439
- [x] *Has spec*
418440
- [x] **BUG**: Need to fix the grouping of expressions to allow for expressions to be logically organized.

lib/index.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
var _ = require('lodash'),
22
prom = require('promise/lib/es6-extensions'),
3-
parser = require('./sql-parser'),
4-
top = typeof global !== "undefined" && global !== null ? global : self,
5-
p = top.Promise;
6-
7-
/** @note Taken from jakearchibald/es6-promise polyfill.js */
8-
if (p && Object.prototype.toString.call(p.resolve()) === '[object Promise]' && !p.cast) {
9-
// Use existing Promise
10-
prom = p;
11-
}
3+
parser = require('./sql-parser');
124

135
function sqliteParser(source) {
146
return new prom(function(resolve) {
157
resolve(parser.parse(source));
168
});
179
}
1810
sqliteParser['NAME'] = "sqlite-parser";
19-
sqliteParser['VERSION'] = "0.2.3";
11+
sqliteParser['VERSION'] = "0.3.0";
2012

2113
/**!
2214
* sqlite-parser

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sqlite-parser",
3-
"version": "0.2.3",
3+
"version": "0.3.0",
44
"main": "lib/index.js",
55
"private": true,
66
"author": "Code School",

src/index.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
var _ = require('lodash'),
22
prom = require('promise/lib/es6-extensions'),
3-
parser = require('./sql-parser'),
4-
top = typeof global !== "undefined" && global !== null ? global : self,
5-
p = top.Promise;
6-
7-
/** @note Taken from jakearchibald/es6-promise polyfill.js */
8-
if (p && Object.prototype.toString.call(p.resolve()) === '[object Promise]' && !p.cast) {
9-
// Use existing Promise
10-
prom = p;
11-
}
3+
parser = require('./sql-parser');
124

135
function sqliteParser(source) {
146
return new prom(function(resolve) {
157
resolve(parser.parse(source));
168
});
179
}
1810
sqliteParser['NAME'] = "sqlite-parser";
19-
sqliteParser['VERSION'] = "0.2.3";
11+
sqliteParser['VERSION'] = "0.3.0";
2012

2113
/**!
2214
* sqlite-parser

0 commit comments

Comments
 (0)