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.21 to 1.0.22

6

lib/mysqlSimpleQuery.js

@@ -209,3 +209,3 @@ const dbQuery = require('./util/dbQuery');

insert(table, data) {
insert(table, data, returnID = false) {
const last = Object.keys(data)[Object.keys(data).length - 1];

@@ -237,2 +237,6 @@ let query = `INSERT INTO ${table} `;

if (returnID) {
query += ';SELECT LAST_INSERT_ID() AS `id`;';
}
return query.trim();

@@ -239,0 +243,0 @@ }

2

package.json
{
"name": "mysql-simple-query",
"version": "1.0.21",
"version": "1.0.22",
"description": "Simple query wrapper for mysql-promise to make querying, inserting, updating, and deleting easier for developers.",

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

@@ -212,3 +212,3 @@ const dbQuery = require('./util/dbQuery');

insert(table, data) {
insert(table, data, returnID = false) {
const last = Object.keys(data)[Object.keys(data).length-1];

@@ -242,2 +242,6 @@ let query = `INSERT INTO ${table} `;

if (returnID) {
query += ';SELECT LAST_INSERT_ID() AS `id`;';
}
return query.trim();

@@ -244,0 +248,0 @@ }

@@ -145,3 +145,3 @@ const expect = require('chai').expect;

'datetime': '2019-08-27 03:11:06'
}, true);
});

@@ -151,2 +151,14 @@ expect(results).to.equal('INSERT INTO product_option_set (product_id,option_set_uuid,datetime) VALUES (\'1111\',\'2222\',\'2019-08-27 03:11:06\')');

it('insert with return ID', () => {
const test = new mysqlSimpleQuery();
const results = test.insert('product_option_set', {
'product_id': 1111,
'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 (\'1111\',\'2222\',\'2019-08-27 03:11:06\');SELECT LAST_INSERT_ID() AS `id`;');
});
it('update without where clause', () => {

@@ -153,0 +165,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