mirror of
https://github.com/knex/knex.git
synced 2025-12-28 07:29:16 +00:00
Use calling transaction with batchInsert
This commit is contained in:
parent
d40e578cad
commit
202ddddddb
@ -19,6 +19,10 @@ export default class BatchInsert {
|
||||
this._returning = void 0;
|
||||
this._transaction = null;
|
||||
this._autoTransaction = true;
|
||||
|
||||
if (client.transacting) {
|
||||
this.transacting(client);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user