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

Commit 7e9f8ef

Browse files
committed
Add CHANGELOG.md entry for CLI. Refs #26
1 parent 8b0bdca commit 7e9f8ef

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,32 @@ All notable changes to this project will be documented in this file.
1919
}
2020
```
2121

22+
- There is now a command line version of the parser when it is installed as a global module (e.g., `npm i -g sqlite-parser`). The `sqlite-parser` command is then available to use to parse input SQL files and write the results to stdout or a JSON file. Additional usage instructions and options available through `sqlite-parser --help`.
23+
24+
```
25+
sqlite-parser input.sql --output foo.json
26+
```
27+
28+
- To allow users to parse arbitrarily long SQL files or other readable stream sources, there is now a stream transform that can accept a readable stream and then push (write) out JSON strings of the ASTs for individual statements.
29+
- The AST for each statement is pushed down the stream as soon as it is read and parsed instead of reading the entire file into memory before parsing begins.
30+
31+
``` javascript
32+
var parserTransform = require('sqlite-parser').createParser();
33+
var readStream = require('fs').createReadStream('./large-input-file.sql');
34+
35+
readStream.pipe(parserTransform);
36+
parserTransform.pipe(process.stdout);
37+
38+
parserTransform.on('error', function (err) {
39+
console.error(err);
40+
process.exit(1);
41+
});
42+
43+
parserTransform.on('finish', function () {
44+
process.exit(0);
45+
});
46+
```
47+
2248
- Added missing `ATTACH DATABASE` statement. It will pair nicely with the existing `DETACH DATABASE` statement.
2349

2450
``` sql

0 commit comments

Comments
 (0)