You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP

sql-bricks

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sql-bricks - npm Package Compare versions

Comparing version

to
2.0.2

{
"name": "sql-bricks",
"version": "2.0.1",
"version": "2.0.2",
"author": "Peter Rust <peter@cornerstonenw.com>",

@@ -5,0 +5,0 @@ "description": "Transparent, Schemaless SQL Generation",

@@ -378,8 +378,11 @@ (function() {

Insert.defineClause('values', function(opts) {
if (this._select)
if (this._select) {
return this._select._toString(opts);
else
}
else {
var pickOrder = _.keys(this._values[0]);
return 'VALUES ' + _.map(this._values, function(values) {
return '(' + handleValues(_.values(values), opts).join(', ') + ')';
return '(' + handleValues(_.values(_.pick(values, pickOrder)), opts).join(', ') + ')';
}).join(', ');
}
});

@@ -386,0 +389,0 @@

@@ -203,2 +203,6 @@ (function() {

});
it('should support value objects with differing field orders', function() {
check(insert('user').values([{id: 1, name: 'Fred'}, {name: 'Barney', id: 2}]),
"INSERT INTO \"user\" (id, name) VALUES (1, 'Fred'), (2, 'Barney')")
})

@@ -205,0 +209,0 @@ describe('.toString() value conversions', function() {