Socket
Socket
Sign inDemoInstall

knex-on-duplicate-update

Package Overview
Dependencies
26
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.1.2

13

lib/index.js
const KnexQueryBuilder = require('knex/lib/query/builder');
const escapeKnexBinding = input => input.replace(/\?/g, '\\?');
module.exports.attachOnDuplicateUpdate = function attachOnDuplicateUpdate() {

@@ -31,7 +29,14 @@ KnexQueryBuilder.prototype.onDuplicateUpdate = function (...columns) {

const {
sql: originalSQL,
bindings: originalBindings,
} = this.toSQL();
const newBindings = [ ...originalBindings, ...bindings ];
return this.client.raw(
`${escapeKnexBinding(this.toString())} on duplicate key update ${placeholders.join(', ')}`,
bindings
`${originalSQL} on duplicate key update ${placeholders.join(', ')}`,
newBindings,
);
};
};
{
"name": "knex-on-duplicate-update",
"version": "1.1.1",
"version": "1.1.2",
"description": "Simple patcher for Knex. It adds the .onDuplicateUpdate() function to knex's query builder.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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