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

Commit 4ca4cf4

Browse files
committed
sqlite-parser is now completely free of runtime dependencies as promise has been removed as a dependency. you can still use the library as a promise-based module, but you have to include and require promise manually. refs #2
1 parent 90aaf5a commit 4ca4cf4

File tree

10 files changed

+523
-72
lines changed

10 files changed

+523
-72
lines changed

CHANGELOG.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,39 @@
22
All notable changes to this project will be documented in this file.
33

44
## [Unreleased][unreleased]
5+
6+
## [v0.9.0] - 2015-07-05
57
### Changed
8+
- `sqlite-parser` is now completely **free of runtime dependencies** as `promise` has been removed as a dependency. you can still use the library as a promise-based module, but you have to include and `require('promise')` manually.
9+
10+
``` javascript
11+
// Promise-based usage
12+
var Promise = require('promise'),
13+
sqliteParser = Promise.denodeify(require('sqlite-parser'));
14+
sqliteParser("SELECT * FROM bees")
15+
.then(function (res) {
16+
// Result AST
17+
console.log(res);
18+
}, function (err) {
19+
// Error
20+
console.log(err);
21+
});
22+
```
23+
24+
``` javascript
25+
// Standard usage
26+
var sqliteParser = require('sqlite-parser');
27+
sqliteParser("SELECT * FROM bees", function (err, res) {
28+
if (err) {
29+
// Error
30+
console.log(err);
31+
} else {
32+
// Result AST
33+
console.log(res);
34+
}
35+
});
36+
```
37+
638
- forked `pegjs` repository as `nwronski/pegjs` to get the changes into `pegjs` core into version control so they are not accidentally overwritten
739
- getting closer to displaying correct error location when there are multiple statements in the input SQL
840

@@ -257,7 +289,8 @@ fixed value format for direction key in PRIMARY KEY table contrainsts cleaned up
257289
### Added
258290
- First working version of sqlite-parser
259291

260-
[unreleased]: https://github.com/codeschool/sqlite-parser/compare/v0.8.0...HEAD
292+
[unreleased]: https://github.com/codeschool/sqlite-parser/compare/v0.9.0...HEAD
293+
[v0.9.0]: https://github.com/codeschool/sqlite-parser/compare/v0.8.0...v0.9.0
261294
[v0.8.0]: https://github.com/codeschool/sqlite-parser/compare/v0.6.0...v0.8.0
262295
[v0.6.0]: https://github.com/codeschool/sqlite-parser/compare/v0.3.1...v0.6.0
263296
[v0.3.1]: https://github.com/codeschool/sqlite-parser/compare/6388118d601a89d011ecd6f5c215bbc9763444db...v0.3.1

README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,23 @@ npm install sqlite-parser
3131

3232
## Usage
3333

34-
The library exposes a function that accepts a single argument: a string
35-
containing SQL to parse. The method returns a `Promise` that resolves to the
36-
AST object generated from the source string.
34+
The library exposes a function that accepts two arguments: a string
35+
containing SQL to parse and a callback function. The function will invoke
36+
the callback function with the AST object generated from the source string.
3737

3838
``` javascript
39-
var sqliteParser = require('sqlite-parser'),
40-
sampleSQL = "SELECT type, quantity FROM apples WHERE amount > 1";
41-
42-
sqliteParser(sampleSQL)
43-
.then(function (tree) {
44-
// AST generated
45-
console.log(tree);
46-
}, function (err) {
47-
// Parse error thrown
48-
console.log(err);
39+
// Standard usage
40+
var sqliteParser = require('sqlite-parser'),
41+
sampleSQL = "SELECT type, quantity FROM apples WHERE amount > 1";
42+
43+
sqliteParser(sampleSQL, function (err, res) {
44+
if (err) {
45+
// Error
46+
console.log(err);
47+
} else {
48+
// Result AST
49+
console.log(res);
50+
}
4951
});
5052
```
5153

demo/js/demo.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
(function (root) {
2-
var sqliteParser = require('sqlite-parser'),
3-
util = require('sqlite-parser-util'),
4-
CodeMirror = require('codemirror'),
5-
panel = document.getElementById('ast'),
6-
msgArea = document.getElementById('ast-header'),
7-
elemSql = document.getElementById('sql-text'),
8-
elemAst = document.getElementById('ast-text');
2+
var Promise = require('promise'),
3+
sqliteParser = Promise.denodeify(require('sqlite-parser')),
4+
util = require('sqlite-parser-util'),
5+
CodeMirror = require('codemirror'),
6+
panel = document.getElementById('ast'),
7+
msgArea = document.getElementById('ast-header'),
8+
elemSql = document.getElementById('sql-text'),
9+
elemAst = document.getElementById('ast-text');
910

1011
require('foldcode');
1112
require('foldgutter');

0 commit comments

Comments
 (0)