mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 00:16:00 +00:00
introduced dbhandle instead of overwriting 3rd party client's fields
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
const { createBulkInsertStreamBase } = global.DBGATE_PACKAGES['dbgate-tools'];
|
||||
|
||||
function runBulkInsertBatch(pool, tableName, writable, rows) {
|
||||
function runBulkInsertBatch(dbhan, tableName, writable, rows) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const tableMgr = pool.tableMgr();
|
||||
const tableMgr = dbhan.client.tableMgr();
|
||||
tableMgr.bind(tableName, bulkMgr => {
|
||||
bulkMgr.insertRows(rows, err => {
|
||||
if (err) reject(err);
|
||||
@@ -16,8 +16,8 @@ function runBulkInsertBatch(pool, tableName, writable, rows) {
|
||||
*
|
||||
* @param {import('dbgate-types').EngineDriver} driver
|
||||
*/
|
||||
function createNativeBulkInsertStream(driver, stream, pool, name, options) {
|
||||
const writable = createBulkInsertStreamBase(driver, stream, pool, name, options);
|
||||
function createNativeBulkInsertStream(driver, stream, dbhan, name, options) {
|
||||
const writable = createBulkInsertStreamBase(driver, stream, dbhan, name, options);
|
||||
|
||||
const fullName = name.schemaName ? `[${name.schemaName}].[${name.pureName}]` : name.pureName;
|
||||
|
||||
@@ -25,7 +25,7 @@ function createNativeBulkInsertStream(driver, stream, pool, name, options) {
|
||||
const rows = writable.buffer;
|
||||
writable.buffer = [];
|
||||
|
||||
await runBulkInsertBatch(pool, fullName, writable, rows);
|
||||
await runBulkInsertBatch(dbhan, fullName, writable, rows);
|
||||
};
|
||||
|
||||
return writable;
|
||||
|
||||
Reference in New Issue
Block a user