Use calling transaction with batchInsert

This commit is contained in:
Alex Whitman 2016-05-16 22:10:35 +01:00 committed by Alex Whitman
parent d40e578cad
commit 202ddddddb
2 changed files with 13 additions and 0 deletions

View File

@ -19,6 +19,10 @@ export default class BatchInsert {
this._returning = void 0;
this._transaction = null;
this._autoTransaction = true;
if (client.transacting) {
this.transacting(client);
}
}
/**

View File

@ -702,6 +702,15 @@ module.exports = function(knex) {
})
});
it('transaction.batchInsert using specified transaction', function() {
return knex.transaction(function(tr) {
tr.batchInsert('BatchInsert', items, 30)
.returning(['Col1', 'Col2'])
.then(tr.commit)
.catch(tr.rollback);
})
});
});
it('should validate batchInsert batchSize parameter', function() {