Skip to content

Commit d4fe5c6

Browse files
committed
Merge branch '6' into 7
2 parents 4675066 + b16835e commit d4fe5c6

File tree

5 files changed

+33
-12
lines changed

5 files changed

+33
-12
lines changed

CHANGELOG.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
v7.3.0 (2021-11-18)
2+
-------------------
3+
[new] Transaction/PreparedStatements expose the config from their parent connection
4+
[fix] Fix inherited request configs from the pool. Specifically stream and arrayRowMode now inherit accurately from the connection config ([#1338](https://github.com/tediousjs/node-mssql/pull/1338))
5+
16
v7.2.1 (2021-08-19)
27
-------------------
38
[fix] Fix issue with bulk insert of dates ((#1298)[https://github.com/tediousjs/node-mssql/pull/1298])
@@ -44,6 +49,11 @@ v7.0.0 (2021-05-06)
4449
[fix] Connection config objects are now deep cloned when stored against a connection pool ([#1217](https://github.com/tediousjs/node-mssql/pull/1217))
4550
[removed] Support for connection uri format has been removed (eg: `mssql://user:password@host/?params=values`)
4651

52+
v6.4.0 (2021-11-18)
53+
-------------------
54+
[new] Transaction/PreparedStatements expose the config from their parent connection
55+
[fix] Fix inherited request configs from the pool. Specifically stream and arrayRowMode now inherit accurately from the connection config ([#1338](https://github.com/tediousjs/node-mssql/pull/1338))
56+
4757
v6.3.2 (2021-05-13)
4858
-------------------
4959
[fix] Bump various dependencies for security fixes

lib/base/prepared-statement.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ class PreparedStatement extends EventEmitter {
3535
this.parameters = {}
3636
}
3737

38+
get config () {
39+
return this.parent.config
40+
}
41+
3842
get connected () {
3943
return this.parent.connected
4044
}

lib/base/request.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Request extends EventEmitter {
2626
/**
2727
* Create new Request.
2828
*
29-
* @param {Connection|ConnectionPool|Transaction|PreparedStatement} parent If ommited, global connection is used instead.
29+
* @param {Connection|ConnectionPool|Transaction|PreparedStatement} parent If omitted, global connection is used instead.
3030
*/
3131

3232
constructor (parent) {
@@ -39,6 +39,8 @@ class Request extends EventEmitter {
3939
this._paused = false
4040
this.parent = parent || globalConnection.pool
4141
this.parameters = {}
42+
this.stream = null
43+
this.arrayRowMode = null
4244
}
4345

4446
get paused () {
@@ -224,8 +226,8 @@ class Request extends EventEmitter {
224226
*/
225227

226228
batch (batch, callback) {
227-
if (this.stream == null && this.connection) this.stream = this.connection.config.stream
228-
if (this.arrayRowMode == null && this.connection) this.arrayRowMode = this.connection.config.arrayRowMode
229+
if (this.stream === null && this.parent) this.stream = this.parent.config.stream
230+
if (this.arrayRowMode === null && this.parent) this.arrayRowMode = this.parent.config.arrayRowMode
229231
this.rowsAffected = 0
230232

231233
if (typeof callback === 'function') {
@@ -288,11 +290,11 @@ class Request extends EventEmitter {
288290
*/
289291

290292
_batch (batch, callback) {
291-
if (!this.connection) {
293+
if (!this.parent) {
292294
return setImmediate(callback, new RequestError('No connection is specified for that request.', 'ENOCONN'))
293295
}
294296

295-
if (!this.connection.connected) {
297+
if (!this.parent.connected) {
296298
return setImmediate(callback, new ConnectionError('Connection is closed.', 'ECONNCLOSED'))
297299
}
298300

@@ -317,8 +319,8 @@ class Request extends EventEmitter {
317319
options = {}
318320
}
319321

320-
if (this.stream == null && this.connection) this.stream = this.connection.config.stream
321-
if (this.arrayRowMode == null && this.connection) this.arrayRowMode = this.connection.config.arrayRowMode
322+
if (this.stream === null && this.parent) this.stream = this.parent.config.stream
323+
if (this.arrayRowMode === null && this.parent) this.arrayRowMode = this.parent.config.arrayRowMode
322324

323325
if (this.stream || typeof callback === 'function') {
324326
this._bulk(table, options, (err, rowsAffected) => {
@@ -419,8 +421,8 @@ class Request extends EventEmitter {
419421
*/
420422

421423
query (command, callback) {
422-
if (this.stream == null && this.connection) this.stream = this.connection.config.stream
423-
if (this.arrayRowMode == null && this.connection) this.arrayRowMode = this.connection.config.arrayRowMode
424+
if (this.stream === null && this.parent) this.stream = this.parent.config.stream
425+
if (this.arrayRowMode === null && this.parent) this.arrayRowMode = this.parent.config.arrayRowMode
424426
this.rowsAffected = 0
425427

426428
if (typeof callback === 'function') {
@@ -508,8 +510,8 @@ class Request extends EventEmitter {
508510
*/
509511

510512
execute (command, callback) {
511-
if (this.stream == null && this.connection) this.stream = this.connection.config.stream
512-
if (this.arrayRowMode == null && this.connection) this.arrayRowMode = this.connection.config.arrayRowMode
513+
if (this.stream === null && this.parent) this.stream = this.parent.config.stream
514+
if (this.arrayRowMode === null && this.parent) this.arrayRowMode = this.parent.config.arrayRowMode
513515
this.rowsAffected = 0
514516

515517
if (typeof callback === 'function') {

lib/base/transaction.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ class Transaction extends EventEmitter {
3737
this.name = ''
3838
}
3939

40+
get config () {
41+
return this.parent.config
42+
}
43+
4044
get connected () {
4145
return this.parent.connected
4246
}

package-lock.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)