New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

simple-sql-parser

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-sql-parser - npm Package Compare versions

Comparing version

to
0.0.4

2

package.json

@@ -9,3 +9,3 @@ {

"license": "MIT",
"version": "0.0.3",
"version": "0.0.4",
"author": "dsferruzza",

@@ -12,0 +12,0 @@ "contributors": [

@@ -19,3 +19,3 @@ sqlParser.js

```js
var sqlParser = require('sqlParser');
var sqlParser = require('simple-sql-parser');
```

@@ -22,0 +22,0 @@

@@ -9,3 +9,3 @@ function trim(str) {

function protect_split(separator, str) {
var sep = '######';
var sep = separator || '######';

@@ -68,3 +68,3 @@ var string = false;

}));
var parts_order = new Array();
var parts_order = [];

@@ -122,3 +122,3 @@ // Hide words defined as separator but written inside brackets in the query

// Define analysis functions
var analysis = new Array();
var analysis = [];

@@ -146,3 +146,3 @@ analysis['SELECT'] = analysis['SET'] = function (str) {

str = str.split(' ON ');
var result = new Object();
var result = {};
result['table'] = trim(str[0]);

@@ -159,3 +159,3 @@ result['cond'] = trim(str[1]);

str = str.split(',');
var result = new Array();
var result = [];
str.forEach(function (item, key) {

@@ -165,3 +165,3 @@ var order_by = /([A-Za-z0-9_\.]+)\s+(ASC|DESC){1}/gi;

if (order_by != null) {
var tmp = new Object();
var tmp = {};
tmp['column'] = trim(order_by[1]);

@@ -179,3 +179,3 @@ tmp['order'] = trim(order_by[2]);

if (typeof limit[2] == 'undefined') limit[2] = 1;
var result = new Object();
var result = {};
result['nb'] = parseInt(trim(limit[3]));

@@ -189,3 +189,3 @@ result['from'] = parseInt(trim(limit[2]));

insert = insert.exec(str);
var result = new Object();
var result = {};
result['table'] = trim(insert[1]);

@@ -203,5 +203,5 @@ if (typeof insert[3] != 'undefined') {

var groups = protect_split(',', str);
var result = new Array();
var result = {};
groups.forEach(function(group) {
var group = group.replace(/^\(/g,'').replace(/\)$/g,'');
group = group.replace(/^\(/g,'').replace(/\)$/g,'');
group = protect_split(',', group);

@@ -216,3 +216,3 @@ result.push(group);

// Analyze parts
var result = new Object();
var result = {};
var j = 0;

@@ -228,3 +228,3 @@ parts_order.forEach(function (item, key) {

var tmp = result[item];
result[item] = new Array();
result[item] = [];
result[item].push(tmp);

@@ -382,3 +382,3 @@ }

return {type: 'operator', value: tokenValue};
},
}
};

@@ -482,3 +482,3 @@

return astNode;
},
}
};

@@ -489,4 +489,4 @@

return new CondParser(source).parseExpressionsRecursively();
}
};
module.exports = parseSQL;

Sorry, the diff of this file is not supported yet