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

knex

Package Overview
Dependencies
Maintainers
1
Versions
252
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knex - npm Package Compare versions

Comparing version 0.5.13 to 0.5.14

test/integration/output/Deletes.js

7

clients/server/mysql.js

@@ -47,3 +47,8 @@ // MySQL

getRawConnection: function() {
var connection = mysql.createConnection(this.connectionSettings);
var connection;
if (this.connectionSettings.charset === 'utf8') {
connection = mysql.createConnection(_.omit(this.connectionSettings, 'charset'));
} else {
connection = mysql.createConnection(this.connectionSettings);
}
return Promise.promisify(connection.connect, connection)().yield(connection);

@@ -50,0 +55,0 @@ },

15

clients/server/postgres/grammar.js

@@ -52,2 +52,9 @@ // PostgreSQL Grammar

// Compiles a `delete` query, allowing for a return value.
compileDelete: function(qb) {
var sql = baseGrammar.compileDelete.apply(this, arguments);
sql += this.compileReturning(qb);
return sql;
},
// Adds the returning value to the statement.

@@ -70,3 +77,3 @@ compileReturning: function(qb) {

if (response.command === 'SELECT') return response.rows;
if (response.command === 'INSERT' || (response.command === 'UPDATE' && returning)) {
if (response.command === 'INSERT' || returning) {
return _.map(response.rows, function(row) {

@@ -77,8 +84,6 @@ if (returning === '*' || _.isArray(returning)) return row;

}
if (response.command === 'UPDATE' || response.command === 'DELETE') {
return response.rowCount;
}
return '';
return response.rowCount;
}
}, baseGrammar);

@@ -1,2 +0,2 @@

// Knex.js 0.5.13
// Knex.js 0.5.14
// --------------

@@ -91,3 +91,3 @@

// Keep in sync with package.json
knex.VERSION = '0.5.13';
knex.VERSION = '0.5.14';

@@ -94,0 +94,0 @@ // Runs a new transaction, taking a container and returning a promise

@@ -30,3 +30,3 @@ // Builder

var operators = ['=', '<', '>', '<=', '>=', '<>', '!=', 'like', 'not like',
'between', 'ilike', '&', '&&', '|', '^', '#', '<<', '>>'];
'between', 'ilike', '&', '&&', '|', '^', '#', '<<', '>>', '@>', '<@', '||'];

@@ -451,8 +451,9 @@ var nullOperators = ['is', 'is not'];

// Alias to del.
"delete": function() {
return this._setType('delete');
"delete": function(returning) {
return this.del(returning);
},
// Executes a delete statement on the query;
del: function() {
del: function(returning) {
if (returning) this.returning(returning);
return this._setType('delete');

@@ -459,0 +460,0 @@ },

{
"name": "knex",
"version": "0.5.13",
"version": "0.5.14",
"description": "A query builder for Postgres, MySQL and SQLite3, designed to be flexible, portable, and fun to use.",

@@ -12,3 +12,3 @@ "main": "knex.js",

"objectdump": "~0.3.0",
"mysql": "~2.0.0-rc2",
"mysql": "~2.2.0",
"pg": "~2.8.2",

@@ -15,0 +15,0 @@ "sqlite3": "~2.1.7",

module.exports = function(knex) {
describe('deletes', function () {
describe('Deletes', function () {
it('should delete an item', function() {
it('should handle deletes', function() {
return knex('accounts')
.where({'email':'test2@example.com'})
.logMe()
.where('id', 1)
.del();
});
it('should allow returning for deletes in postgresql', function() {
return knex('accounts')
.logMe()
.where('id', 2)
.del('*');
});

@@ -15,2 +21,2 @@

};
};

@@ -104,7 +104,9 @@ var isDev = parseInt(process.env.KNEX_DEV, 10);

parseBindingDates(newData, localData);
} if (item === 'result') {
}
if (item === 'result') {
parseResultDates(newData, localData);
}
expect(localData).to.eql(newData);
expect(newData).to.eql(localData);
});

@@ -111,0 +113,0 @@

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