simple-sql-parser
Advanced tools
Comparing version 0.0.5 to 1.0.0
{ | ||
"name": "simple-sql-parser", | ||
"description": "Javascript library to parse CRUD (Create Retrieve Update Delete) SQL queries.", | ||
"keywords": [ | ||
"sql", | ||
"parser" | ||
], | ||
"license": "MIT", | ||
"version": "0.0.5", | ||
"author": "dsferruzza", | ||
"contributors": [ | ||
{ | ||
"name": "David Sferruzza", | ||
"email": "david.sferruzza@gmail.com" | ||
}, | ||
{ | ||
"name": "RienNeVaPlus" | ||
} | ||
], | ||
"private": false, | ||
"repository": { | ||
"type":"git", | ||
"url":"https://github.com/RienNeVaPlus/sqlParser.js" | ||
}, | ||
"main": "sqlParser.js", | ||
"engines": { | ||
"node": ">=0.10.5" | ||
}, | ||
"dependencies":{ | ||
} | ||
} | ||
"name": "simple-sql-parser", | ||
"description": "Javascript library to parse CRUD (Create Retrieve Update Delete) SQL queries.", | ||
"version": "1.0.0", | ||
"main": "simpleSqlParser.js", | ||
"keywords": [ | ||
"sql", | ||
"parse", | ||
"ast" | ||
], | ||
"author": { | ||
"name": "David Sferruzza", | ||
"email": "david.sferruzza@gmail.com", | ||
"url": "https://github.com/dsferruzza" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "RienNeVaPlus", | ||
"url": "https://github.com/RienNeVaPlus" | ||
} | ||
], | ||
"maintainers": [ | ||
{ | ||
"name": "David Sferruzza", | ||
"email": "david.sferruzza@gmail.com", | ||
"url": "https://github.com/dsferruzza" | ||
} | ||
], | ||
"bugs": { | ||
"url": "https://github.com/dsferruzza/simpleSqlParser/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/dsferruzza/simpleSqlParser.git" | ||
}, | ||
"license": "MIT", | ||
"homepage": "https://github.com/dsferruzza/simpleSqlParser", | ||
"devDependencies": { | ||
"grunt": "*", | ||
"grunt-contrib-qunit": "*", | ||
"grunt-contrib-jshint": "*", | ||
"grunt-contrib-watch": "*" | ||
}, | ||
"scripts": { | ||
"test": "grunt" | ||
} | ||
} |
@@ -1,42 +0,48 @@ | ||
sqlParser.js | ||
============ | ||
simpleSqlParser | ||
=============== | ||
Node.js Javascript library to parse CRUD (Create Retrieve Update Delete) SQL queries. | ||
Javascript library to parse CRUD (Create Retrieve Update Delete) SQL queries. | ||
Note: this is a Fork of https://github.com/dsferruzza/sqlParser.js | ||
## How to use | ||
## How to install | ||
### From browser | ||
Import the JS file in your page: | ||
```html | ||
<script src="simpleSqlParser.js"></script> | ||
``` | ||
npm install simple-sql-parser | ||
``` | ||
## How to use | ||
### From Node.js | ||
Require the parser: | ||
Import the JS module in your app: | ||
```js | ||
var sqlParser = require('simple-sql-parser'); | ||
var simpleSqlParser = require('./simpleSqlParser.js'); | ||
``` | ||
Parse a query: | ||
### Parse a query: | ||
```js | ||
var statement = 'SELECT * FROM table WHERE field = value'; | ||
var result = sqlParser(statement); | ||
console.log(result); | ||
var ast = simpleSqlParser.sql2ast('your SQL query'); | ||
console.log(ast); | ||
``` | ||
## Result | ||
### Create a query from AST: | ||
```js | ||
{ | ||
SELECT: [ '*' ], | ||
FROM: [ 'table' ], | ||
WHERE: { operator: '=', left: 'field', right: 'value' } | ||
} | ||
var query = simpleSqlParser.ast2sql(ast); | ||
console.log(query); | ||
``` | ||
*AST means Abstract Syntax Tree.* | ||
## Examples | ||
* See `example.html` (open brower's console) | ||
* Have a look to the unit tests `tests/tests.js` to see what's possible | ||
## Notes | ||
sqlParser.js only supports these queries: | ||
simpleSqlParser only supports these queries: | ||
* SELECT | ||
@@ -47,7 +53,7 @@ * INSERT | ||
sqlParser.js **is not a full SQL parser!** | ||
simpleSqlParser **is not a full SQL parser!** | ||
It only support few SQL mechanisms and keywords. | ||
Feel free to make a pull request/issue. | ||
*sqlParser.js was made for @GestionAIR* | ||
*simpleSqlParser was made for @GestionAIR* | ||
@@ -54,0 +60,0 @@ ## License |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
111949
3288
1
0
70
4
11
2