Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mysql-simple-query

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mysql-simple-query - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

22

lib/mysqlSimpleQuery.js

@@ -9,2 +9,4 @@ const dbQuery = require('./util/dbQuery');

this.whereStatement = {};
this.whereLikeStatement = {};
this.whereLikeCondition = null;
this.groupByStatement = '';

@@ -40,2 +42,10 @@ this.orderByStatement = '';

whereLike(key, value, condition) {
this.whereLikeStatement[key] = value;
if (condition) {
this.whereLikeCondition = condition;
}
}
parseWhere() {

@@ -49,2 +59,10 @@ if (!isEmpty(this.whereStatement)) {

parseWhereLike() {
if (!isEmpty(this.whereLikeStatement)) {
return dbQuery.parseWhereLike(this.whereLikeStatement, this.whereLikeCondition);
}
return '';
}
groupBy(key) {

@@ -90,2 +108,6 @@ if (key) {

if (this.parseWhereLike() !== '') {
queryStatement += ` ${this.parseWhereLike()}`;
}
if (this.groupByStatement !== '') {

@@ -92,0 +114,0 @@ queryStatement += ` ${this.groupByStatement}`;

@@ -53,2 +53,17 @@ const select = select => {

const parseWhereLike = (whereObject, orStatement = false) => {
let whereStatement = [];
for (let key of Object.keys(whereObject)) {
const value = whereObject[key];
whereStatement.push(`${key} LIKE "${value}"`);
}
if (orStatement) {
return `WHERE ${whereStatement.join(' OR ')}`;
}
return `WHERE ${whereStatement.join(' AND ')}`;
};
const groupBy = key => {

@@ -94,2 +109,3 @@ if (key) {

parseWhere,
parseWhereLike,
groupBy,

@@ -96,0 +112,0 @@ orderBy,

2

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

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

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