@pi-r/mssql 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/client/index.js +7 -7
  2. package/package.json +4 -4
package/client/index.js CHANGED
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DB_SOURCE_TYPE = exports.DB_SOURCE_CLIENT = exports.checkTimeout = exports.executeBatchQuery = exports.executeQuery = exports.setCredential = void 0;
4
+ const tedious = require("tedious");
4
5
  const types_1 = require("@e-mc/types");
5
6
  const util_1 = require("@e-mc/db/util");
6
7
  const Db = require("@e-mc/db");
8
+ const TediousPool = require('tedious-connection-pool2');
7
9
  const DbPool = require('@e-mc/db/pool');
8
10
  class MSSQLPool extends DbPool {
9
11
  getConnection() {
@@ -200,7 +202,6 @@ function setCredential(item) {
200
202
  }
201
203
  const poolKey = getPoolKey(credential);
202
204
  if (!(pool = POOL_STATE[poolKey]) || pool.closed) {
203
- const Pool = require("tedious-connection-pool2" /* STRINGS.PACKAGE_POOL */);
204
205
  const config = this.getPoolConfig("mssql" /* STRINGS.MODULE_NAME */, password);
205
206
  const poolConfig = (0, types_1.isPlainObject)(item.usePool) ? item.usePool : {};
206
207
  if (config) {
@@ -218,7 +219,7 @@ function setCredential(item) {
218
219
  poolConfig.acquireTimeout ?? (poolConfig.acquireTimeout = queue_idle);
219
220
  }
220
221
  }
221
- new MSSQLPool(new Pool(poolConfig, credential), poolKey, username && password ? { username, password } : undefined).add(item).parent = POOL_STATE;
222
+ new MSSQLPool(new TediousPool(poolConfig, credential), poolKey, username && password ? { username, password } : undefined).add(item).parent = POOL_STATE;
222
223
  }
223
224
  else {
224
225
  pool.add(item);
@@ -235,7 +236,6 @@ async function executeBatchQuery(batch, options = '', outResult) {
235
236
  if (length === 0) {
236
237
  return [];
237
238
  }
238
- const db = require("tedious" /* STRINGS.PACKAGE_NAME */);
239
239
  let parallel, connectOnce, errorQuery, sessionKey, outCacheMiss;
240
240
  if ((0, types_1.isPlainObject)(options)) {
241
241
  ({ parallel, connectOnce, errorQuery, sessionKey, outCacheMiss } = options);
@@ -301,7 +301,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
301
301
  }
302
302
  if (!client) {
303
303
  clients.push(client = await new Promise((resolve, reject) => {
304
- const sql = new db.Connection(mssqlCredential || credential);
304
+ const sql = new tedious.Connection(mssqlCredential || credential);
305
305
  sql.connect(err => {
306
306
  if (err) {
307
307
  reject(err);
@@ -386,7 +386,7 @@ async function executeBatchQuery(batch, options = '', outResult) {
386
386
  const processRow = typeof streamRow === 'function' && streamRow;
387
387
  const rows = [];
388
388
  let recordset = 1, resume, output;
389
- const request = new db.Request(query, () => {
389
+ const request = new tedious.Request(query, () => {
390
390
  if (error && this.handleFail(error, item, { errorQuery, commandType })) {
391
391
  reject(error);
392
392
  }
@@ -405,9 +405,9 @@ async function executeBatchQuery(batch, options = '', outResult) {
405
405
  if (isOutputParameters(params)) {
406
406
  ({ input: params, output: paramsOutput } = params);
407
407
  }
408
- convertParameters.call(request, db.TYPES, params, false);
408
+ convertParameters.call(request, tedious.TYPES, params, false);
409
409
  if (paramsOutput) {
410
- convertParameters.call(request, db.TYPES, paramsOutput, true);
410
+ convertParameters.call(request, tedious.TYPES, paramsOutput, true);
411
411
  }
412
412
  }
413
413
  request
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/mssql",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "MSSQL client driver for E-mc.",
5
5
  "main": "client/index.js",
6
6
  "types": "client/index.d.ts",
@@ -21,9 +21,9 @@
21
21
  "license": "MIT",
22
22
  "homepage": "https://github.com/anpham6/pi-r#readme",
23
23
  "dependencies": {
24
- "@e-mc/db": "^0.5.3",
25
- "@e-mc/types": "^0.5.3",
26
- "tedious": "^16.2.0",
24
+ "@e-mc/db": "^0.6.0",
25
+ "@e-mc/types": "^0.6.0",
26
+ "tedious": "^16.4.0",
27
27
  "tedious-connection-pool2": "^2.1.0"
28
28
  }
29
29
  }