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

sql-query

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sql-query - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

25

lib/Dialects/postgresql.js

@@ -7,17 +7,22 @@ exports.escapeId = function () {

exports.escapeVal = function (value, timeZone) {
if (Array.isArray(value)) {
if (value.length === 1 && Array.isArray(value[0])) {
return "(" + value[0].map(exports.escapeVal.bind(this)) + ")";
exports.escapeVal = function (val, timeZone) {
if (val === undefined || val === null) {
return 'NULL';
}
if (Array.isArray(val)) {
if (val.length === 1 && Array.isArray(val[0])) {
return "(" + val[0].map(exports.escapeVal.bind(this)) + ")";
}
return "(" + value.map(exports.escapeVal.bind(this)).join(", ") + ")";
return "(" + val.map(exports.escapeVal.bind(this)).join(", ") + ")";
}
switch (typeof value) {
switch (typeof val) {
case "number":
return value;
return val;
case "boolean":
return value ? "true" : "false";
return val ? "true" : "false";
}
return "'" + value.replace(/\'/g, "''") + "'";
// No need to escape backslashes with default PostgreSQL 9.1+ config.
// Google 'postgresql standard_conforming_strings' for details.
return "'" + val.replace(/\'/g, "''") + "'";
};

2

package.json

@@ -9,3 +9,3 @@ {

],
"version": "0.0.9",
"version": "0.0.10",
"license": "MIT",

@@ -12,0 +12,0 @@ "repository": {

@@ -21,2 +21,12 @@ var common = require('../common');

assert.equal(
dialect.escapeVal(undefined),
'NULL'
);
assert.equal(
dialect.escapeVal(null),
'NULL'
);
assert.equal(
dialect.escapeVal(123),

@@ -23,0 +33,0 @@ "123"

@@ -7,3 +7,3 @@ var common = require('../common');

dialect.escapeId('col'),
"\"col\""
'"col"'
);

@@ -13,3 +13,3 @@

dialect.escapeId('table', 'col'),
"\"table\".\"col\""
'"table"."col"'
);

@@ -19,6 +19,16 @@

dialect.escapeId('table', 'co"l'),
"\"table\".\"co\"\"l\""
'"table"."co""l"'
);
assert.equal(
dialect.escapeVal(undefined),
'NULL'
);
assert.equal(
dialect.escapeVal(null),
'NULL'
);
assert.equal(
dialect.escapeVal(123),

@@ -25,0 +35,0 @@ "123"

@@ -21,2 +21,12 @@ var common = require('../common');

assert.equal(
dialect.escapeVal(undefined),
'NULL'
);
assert.equal(
dialect.escapeVal(null),
'NULL'
);
assert.equal(
dialect.escapeVal(123),

@@ -23,0 +33,0 @@ "123"

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