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.1.2 to 1.1.3

2

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

@@ -6,0 +6,0 @@ "keywords": [

@@ -218,3 +218,17 @@ (function(exports) {

};
analysis['GROUP BY'] = function (str) {
str = str.split(',');
var result = [];
str.forEach(function (item, key) {
var group_by = /([A-Za-z0-9_\.]+)/gi;
group_by = group_by.exec(item);
if (group_by !== null) {
var tmp = {};
tmp['column'] = trim(group_by[1]);
result.push(tmp);
}
});
return result;
};
analysis['LIMIT'] = function (str) {

@@ -257,3 +271,3 @@ var limit = /((\d+)\s*,\s*)?(\d+)/gi;

// TODO: handle GROUP BY and HAVING
// TODO: handle HAVING

@@ -603,3 +617,15 @@ // Analyze parts

}
function group_by(ast) {
if (typeof ast['GROUP BY'] != 'undefined') {
var result = ' GROUP BY ';
var groups = ast['GROUP BY'].map(function (item) {
return item.column;
});
result += groups.join(', ');
return result;
}
else return '';
}
function limit(ast) {

@@ -649,3 +675,3 @@ if (typeof ast['LIMIT'] != 'undefined' && typeof ast['LIMIT'].nb != 'undefined' && parseInt(ast['LIMIT'].nb, 10) > 0) {

if (typeof ast['SELECT'] != 'undefined' && typeof ast['FROM'] != 'undefined') {
result = select(ast) + from(ast) + join(ast) + where(ast) + order_by(ast) + limit(ast);
result = select(ast) + from(ast) + join(ast) + where(ast) + group_by(ast) + order_by(ast) + limit(ast);
}

@@ -652,0 +678,0 @@ else if (typeof ast['INSERT INTO'] != 'undefined') {

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