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 1.2.1 to 1.3.0

3

package.json
{
"name": "simple-sql-parser",
"description": "Javascript library to parse CRUD (Create Retrieve Update Delete) SQL queries.",
"version": "1.2.1",
"version": "1.3.0",
"main": "simpleSqlParser.js",

@@ -39,2 +39,3 @@ "keywords": [

"devDependencies": {
"qunitjs": "*",
"grunt": "*",

@@ -41,0 +42,0 @@ "grunt-contrib-qunit": "*",

@@ -68,3 +68,3 @@ (function(exports) {

// Define which words can act as separator
var keywords = ['SELECT', 'FROM', 'DELETE FROM', 'INSERT INTO', 'UPDATE', 'JOIN', 'LEFT JOIN', 'INNER JOIN', 'ORDER BY', 'GROUP BY', 'HAVING', 'WHERE', 'LIMIT', 'VALUES', 'SET'];
var keywords = ['SELECT', 'FROM', 'DELETE FROM', 'INSERT INTO', 'UPDATE', 'JOIN', 'LEFT JOIN', 'RIGHT JOIN', 'INNER JOIN', 'ORDER BY', 'GROUP BY', 'HAVING', 'WHERE', 'LIMIT', 'VALUES', 'SET'];
var parts_name = keywords.map(function (item) {

@@ -108,3 +108,3 @@ return item + ' ';

// Delete duplicates (caused, for example, by JOIN and LEFT JOIN)
// Delete duplicates (caused, for example, by JOIN and INNER JOIN)
var busy_until = 0;

@@ -116,4 +116,4 @@ parts_order.forEach(function (item, key) {

// Replace JOIN by LEFT JOIN
if (item == 'JOIN') parts_order[key] = 'LEFT JOIN';
// Replace JOIN by INNER JOIN
if (item == 'JOIN') parts_order[key] = 'INNER JOIN';
}

@@ -182,3 +182,3 @@ });

analysis['LEFT JOIN'] = analysis['JOIN'] = analysis['INNER JOIN'] = function (str) {
analysis['LEFT JOIN'] = analysis['JOIN'] = analysis['INNER JOIN'] = analysis['RIGHT JOIN'] = function (str) {
str = str.split(' ON ');

@@ -202,3 +202,3 @@ var table = str[0].split(' AS ');

str.forEach(function (item, key) {
var order_by = /([A-Za-z0-9_\.]+)\s+(ASC|DESC){1}/gi;
var order_by = /([A-Za-z0-9_\.]+)\s*(ASC|DESC){0,1}/gi;
order_by = order_by.exec(item);

@@ -209,2 +209,5 @@ if (order_by !== null) {

tmp['order'] = trim(order_by[2]);
if(order_by[2] === undefined ){
tmp['order']="ASC";
}
result.push(tmp);

@@ -321,2 +324,16 @@ }

}
if (typeof result['RIGHT JOIN'] != 'undefined') {
if (typeof result['JOIN'] == 'undefined') result['JOIN'] = [];
if (typeof result['RIGHT JOIN'][0] != 'undefined') {
result['RIGHT JOIN'].forEach(function (item) {
item.type = 'right';
result['JOIN'].push(item);
});
}
else {
result['RIGHT JOIN'].type = 'right';
result['JOIN'].push(result['RIGHT JOIN']);
}
delete result['RIGHT JOIN'];
}

@@ -323,0 +340,0 @@ // Parse conditions

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc