Socket
Socket
Sign inDemoInstall

mysql-simple-query

Package Overview
Dependencies
0
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.24 to 1.0.25

6

lib/mysqlSimpleQuery.js

@@ -228,5 +228,5 @@ const dbQuery = require('./util/dbQuery');

if (key !== last) {
query += `'${value.toString().replace(/'/g, "\\\'")}',`;
query += `'${value}',`;
} else {
query += `'${value.toString().replace(/'/g, "\\\'")}'`;
query += `'${value}'`;
}

@@ -269,2 +269,2 @@ });

module.exports = mysqlSimpleQuery;
module.exports = mysqlSimpleQuery;

@@ -132,3 +132,3 @@ const select = select => {

const value = data[key];
updateData.push(`${key} = "${value.toString().replace(/'/g, "\\'")}"`);
updateData.push(`${key} = "${value}"`);
}

@@ -152,2 +152,2 @@

offset
};
};
{
"name": "mysql-simple-query",
"version": "1.0.24",
"version": "1.0.25",
"description": "Simple query wrapper for mysql-promise to make querying, inserting, updating, and deleting easier for developers.",

@@ -5,0 +5,0 @@ "main": "mysqlSimpleQuery.js",

@@ -233,5 +233,5 @@ const dbQuery = require('./util/dbQuery');

{
query += `'${value.toString().replace(/'/g, "\\\'").replace(/"/g, '\\"')}',`
query += `'${value}',`
} else {
query += `'${value.toString().replace(/'/g, "\\\'").replace(/"/g, '\\"')}'`
query += `'${value}'`
}

@@ -238,0 +238,0 @@ });

@@ -141,3 +141,3 @@ const select = (select) => {

const value = data[key];
updateData.push(`${key} = "${value.toString().replace(/'/g, "\\'").replace(/"/g, '\\"')}"`);
updateData.push(`${key} = "${value}"`);
}

@@ -144,0 +144,0 @@

@@ -162,26 +162,2 @@ const expect = require('chai').expect;

it('insert with single quotes in values', () => {
const test = new mysqlSimpleQuery();
const results = test.insert('product_option_set', {
'product_id': "this is a's test",
'option_set_uuid': 2222,
'datetime': '2019-08-27 03:11:06'
}, true);
expect(results).to.equal("INSERT INTO product_option_set (product_id,option_set_uuid,datetime) VALUES ('this is a\\'s test','2222','2019-08-27 03:11:06');SELECT LAST_INSERT_ID() AS `id`;");
});
it('insert with double quotes in values', () => {
const test = new mysqlSimpleQuery();
const results = test.insert('product_option_set', {
'product_id': 'this is a"s test',
'option_set_uuid': 2222,
'datetime': '2019-08-27 03:11:06'
}, true);
expect(results).to.equal('INSERT INTO product_option_set (product_id,option_set_uuid,datetime) VALUES (\'this is a\\"s test\',\'2222\',\'2019-08-27 03:11:06\');SELECT LAST_INSERT_ID() AS `id`;');
});
it('update without where clause', () => {

@@ -188,0 +164,0 @@ const test = new mysqlSimpleQuery();

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc