mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 02:51:14 +00:00
fix(Microsoft SQL Node): Prevent MSSQL max parameters error by chunking (#8390)
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
configurePool,
|
||||
deleteOperation,
|
||||
insertOperation,
|
||||
mssqlChunk,
|
||||
updateOperation,
|
||||
} from '../GenericFunctions';
|
||||
|
||||
@@ -142,4 +143,15 @@ describe('MSSQL tests', () => {
|
||||
expect(querySpy).toHaveBeenCalledWith('DELETE FROM [users] WHERE [id] IN (@v0);');
|
||||
assertParameters({ v0: 2 });
|
||||
});
|
||||
|
||||
describe('mssqlChunk', () => {
|
||||
it('should chunk insert values correctly', () => {
|
||||
const chunks = mssqlChunk(
|
||||
new Array(3000)
|
||||
.fill(null)
|
||||
.map((_, index) => ({ id: index, name: 'John Doe', verified: true })),
|
||||
);
|
||||
expect(chunks.map((chunk) => chunk.length)).toEqual([699, 699, 699, 699, 204]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user