node-pg-util
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -436,3 +436,3 @@ 'use strict'; | ||
it('should re-use the same client', function callee$2$0() { | ||
var createTableSQL, insertSQL, selectSQL, client1, client2, row; | ||
var createTableSQL, insertSQL, selectSQL, client, row; | ||
return _regeneratorRuntime.async(function callee$2$0$(context$3$0) { | ||
@@ -448,25 +448,20 @@ while (1) switch (context$3$0.prev = context$3$0.next) { | ||
case 5: | ||
client1 = context$3$0.sent; | ||
client = context$3$0.sent; | ||
context$3$0.next = 8; | ||
return _regeneratorRuntime.awrap(this.db.getClient()); | ||
return _regeneratorRuntime.awrap(this.db.query(client, 'BEGIN')); | ||
case 8: | ||
client2 = context$3$0.sent; | ||
context$3$0.next = 11; | ||
return _regeneratorRuntime.awrap(this.db.query(client1, 'BEGIN')); | ||
context$3$0.next = 10; | ||
return _regeneratorRuntime.awrap(this.db.query(client, createTableSQL)); | ||
case 11: | ||
context$3$0.next = 13; | ||
return _regeneratorRuntime.awrap(this.db.query(client1, createTableSQL)); | ||
case 10: | ||
context$3$0.next = 12; | ||
return _regeneratorRuntime.awrap(this.db.query(client, insertSQL)); | ||
case 13: | ||
case 12: | ||
row = null; | ||
context$3$0.next = 15; | ||
return _regeneratorRuntime.awrap(this.db.query(client1, insertSQL)); | ||
return _regeneratorRuntime.awrap(this.db.one(client, selectSQL)); | ||
case 15: | ||
row = null; | ||
context$3$0.next = 18; | ||
return _regeneratorRuntime.awrap(this.db.one(client1, selectSQL)); | ||
case 18: | ||
row = context$3$0.sent; | ||
@@ -478,14 +473,16 @@ | ||
// should error with a client not used for the transaction | ||
context$3$0.prev = 21; | ||
context$3$0.next = 24; | ||
return _regeneratorRuntime.awrap(this.db.one(client2, selectSQL)); | ||
context$3$0.prev = 18; | ||
context$3$0.next = 21; | ||
return _regeneratorRuntime.awrap(this.db.one(selectSQL)); | ||
case 24: | ||
case 21: | ||
row = context$3$0.sent; | ||
context$3$0.next = 31; | ||
_should2['default'].not.exist(row); | ||
context$3$0.next = 29; | ||
break; | ||
case 27: | ||
context$3$0.prev = 27; | ||
context$3$0.t0 = context$3$0['catch'](21); | ||
case 25: | ||
context$3$0.prev = 25; | ||
context$3$0.t0 = context$3$0['catch'](18); | ||
@@ -495,11 +492,11 @@ _should2['default'].exist(context$3$0.t0); | ||
case 29: | ||
context$3$0.next = 31; | ||
return _regeneratorRuntime.awrap(this.db.query(client, 'ABORT')); | ||
case 31: | ||
context$3$0.next = 33; | ||
return _regeneratorRuntime.awrap(this.db.query(client1, 'ABORT')); | ||
case 33: | ||
case 'end': | ||
return context$3$0.stop(); | ||
} | ||
}, null, this, [[21, 27]]); | ||
}, null, this, [[18, 25]]); | ||
}); | ||
@@ -506,0 +503,0 @@ }); |
{ | ||
"name": "node-pg-util", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "postgresql utils - using promises and the async and await functionality", | ||
@@ -5,0 +5,0 @@ "main": "lib/util.js", |
23038
543