mirror of
https://github.com/knex/knex.git
synced 2025-12-30 00:30:14 +00:00
Fix #422, transactions & Bluebird 2.3
This commit is contained in:
parent
6f4a976944
commit
6bc918f300
@ -73,18 +73,21 @@ require('./interface')(Transaction);
|
||||
// Passed a `container` function, this method runs the current
|
||||
// transaction, returning a promise.
|
||||
Transaction.prototype.then = function(onFulfilled, onRejected) {
|
||||
var Runner = this.client.Runner;
|
||||
|
||||
var Runner = this.client.Runner;
|
||||
var promise = this;
|
||||
|
||||
// Create a new "runner" object, passing the "runner"
|
||||
// object along, so we can easily keep track of every
|
||||
// query run on the current connection.
|
||||
return new Runner(this)
|
||||
.startTransaction()
|
||||
.bind(this)
|
||||
.then(this.containerObject)
|
||||
.then(this.initiateDeferred)
|
||||
.then(onFulfilled, onRejected)
|
||||
.bind();
|
||||
.then(function(obj) {
|
||||
return promise.containerObject(obj);
|
||||
})
|
||||
.then(function(obj) {
|
||||
return promise.initiateDeferred(obj);
|
||||
})
|
||||
.then(onFulfilled, onRejected);
|
||||
};
|
||||
|
||||
module.exports = Transaction;
|
||||
Loading…
x
Reference in New Issue
Block a user