2015-04-22 15:39:29 -04:00
|
|
|
'use strict';
|
2015-04-24 12:19:33 -04:00
|
|
|
|
2015-04-22 10:34:14 -04:00
|
|
|
var makeKnex = require('../../util/make-knex')
|
2015-04-22 15:39:29 -04:00
|
|
|
var Promise = require('../../promise')
|
2015-04-24 12:19:33 -04:00
|
|
|
var inherits = require('inherits')
|
|
|
|
var assign = require('lodash/object/assign');
|
2015-04-19 16:31:52 -04:00
|
|
|
|
2015-04-24 12:19:33 -04:00
|
|
|
function Transaction_WebSQL(client, container, config, outerTx) {
|
|
|
|
this._promise = Promise.try(function() {
|
|
|
|
container(makeKnex(client))
|
2015-04-19 16:31:52 -04:00
|
|
|
})
|
|
|
|
}
|
2015-04-22 15:24:29 -04:00
|
|
|
|
2015-04-24 12:19:33 -04:00
|
|
|
var promiseInterface = [
|
|
|
|
'then', 'bind', 'catch', 'finally', 'asCallback',
|
|
|
|
'spread', 'map', 'reduce', 'tap', 'thenReturn',
|
|
|
|
'return', 'yield', 'ensure', 'nodeify', 'exec'
|
|
|
|
]
|
|
|
|
|
|
|
|
// Creates a method which "coerces" to a promise, by calling a
|
|
|
|
// "then" method on the current `Target`
|
|
|
|
promiseInterface.forEach(function(method) {
|
|
|
|
Transaction_WebSQL.prototype[method] = function() {
|
|
|
|
return (this._promise = this._promise[method].apply(this._promise, arguments))
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2015-04-22 15:39:29 -04:00
|
|
|
module.exports = Transaction_WebSQL
|