pg 8.17.2 → 8.18.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.
- package/lib/client.js +43 -7
- package/lib/native/client.js +2 -2
- package/package.json +3 -3
package/lib/client.js
CHANGED
|
@@ -213,7 +213,7 @@ class Client extends EventEmitter {
|
|
|
213
213
|
if (error) {
|
|
214
214
|
reject(error)
|
|
215
215
|
} else {
|
|
216
|
-
resolve()
|
|
216
|
+
resolve(this)
|
|
217
217
|
}
|
|
218
218
|
})
|
|
219
219
|
})
|
|
@@ -407,23 +407,47 @@ class Client extends EventEmitter {
|
|
|
407
407
|
}
|
|
408
408
|
|
|
409
409
|
_handleRowDescription(msg) {
|
|
410
|
+
const activeQuery = this._getActiveQuery()
|
|
411
|
+
if (activeQuery == null) {
|
|
412
|
+
const error = new Error('Received unexpected rowDescription message from backend.')
|
|
413
|
+
this._handleErrorEvent(error)
|
|
414
|
+
return
|
|
415
|
+
}
|
|
410
416
|
// delegate rowDescription to active query
|
|
411
|
-
|
|
417
|
+
activeQuery.handleRowDescription(msg)
|
|
412
418
|
}
|
|
413
419
|
|
|
414
420
|
_handleDataRow(msg) {
|
|
421
|
+
const activeQuery = this._getActiveQuery()
|
|
422
|
+
if (activeQuery == null) {
|
|
423
|
+
const error = new Error('Received unexpected dataRow message from backend.')
|
|
424
|
+
this._handleErrorEvent(error)
|
|
425
|
+
return
|
|
426
|
+
}
|
|
415
427
|
// delegate dataRow to active query
|
|
416
|
-
|
|
428
|
+
activeQuery.handleDataRow(msg)
|
|
417
429
|
}
|
|
418
430
|
|
|
419
431
|
_handlePortalSuspended(msg) {
|
|
432
|
+
const activeQuery = this._getActiveQuery()
|
|
433
|
+
if (activeQuery == null) {
|
|
434
|
+
const error = new Error('Received unexpected portalSuspended message from backend.')
|
|
435
|
+
this._handleErrorEvent(error)
|
|
436
|
+
return
|
|
437
|
+
}
|
|
420
438
|
// delegate portalSuspended to active query
|
|
421
|
-
|
|
439
|
+
activeQuery.handlePortalSuspended(this.connection)
|
|
422
440
|
}
|
|
423
441
|
|
|
424
442
|
_handleEmptyQuery(msg) {
|
|
443
|
+
const activeQuery = this._getActiveQuery()
|
|
444
|
+
if (activeQuery == null) {
|
|
445
|
+
const error = new Error('Received unexpected emptyQuery message from backend.')
|
|
446
|
+
this._handleErrorEvent(error)
|
|
447
|
+
return
|
|
448
|
+
}
|
|
425
449
|
// delegate emptyQuery to active query
|
|
426
|
-
|
|
450
|
+
activeQuery.handleEmptyQuery(this.connection)
|
|
427
451
|
}
|
|
428
452
|
|
|
429
453
|
_handleCommandComplete(msg) {
|
|
@@ -453,11 +477,23 @@ class Client extends EventEmitter {
|
|
|
453
477
|
}
|
|
454
478
|
|
|
455
479
|
_handleCopyInResponse(msg) {
|
|
456
|
-
this._getActiveQuery()
|
|
480
|
+
const activeQuery = this._getActiveQuery()
|
|
481
|
+
if (activeQuery == null) {
|
|
482
|
+
const error = new Error('Received unexpected copyInResponse message from backend.')
|
|
483
|
+
this._handleErrorEvent(error)
|
|
484
|
+
return
|
|
485
|
+
}
|
|
486
|
+
activeQuery.handleCopyInResponse(this.connection)
|
|
457
487
|
}
|
|
458
488
|
|
|
459
489
|
_handleCopyData(msg) {
|
|
460
|
-
this._getActiveQuery()
|
|
490
|
+
const activeQuery = this._getActiveQuery()
|
|
491
|
+
if (activeQuery == null) {
|
|
492
|
+
const error = new Error('Received unexpected copyData message from backend.')
|
|
493
|
+
this._handleErrorEvent(error)
|
|
494
|
+
return
|
|
495
|
+
}
|
|
496
|
+
activeQuery.handleCopyData(msg, this.connection)
|
|
461
497
|
}
|
|
462
498
|
|
|
463
499
|
_handleNotification(msg) {
|
package/lib/native/client.js
CHANGED
|
@@ -119,7 +119,7 @@ Client.prototype._connect = function (cb) {
|
|
|
119
119
|
self.emit('connect')
|
|
120
120
|
self._pulseQueryQueue(true)
|
|
121
121
|
|
|
122
|
-
cb()
|
|
122
|
+
cb(null, this)
|
|
123
123
|
})
|
|
124
124
|
})
|
|
125
125
|
}
|
|
@@ -135,7 +135,7 @@ Client.prototype.connect = function (callback) {
|
|
|
135
135
|
if (error) {
|
|
136
136
|
reject(error)
|
|
137
137
|
} else {
|
|
138
|
-
resolve()
|
|
138
|
+
resolve(this)
|
|
139
139
|
}
|
|
140
140
|
})
|
|
141
141
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.18.0",
|
|
4
4
|
"description": "PostgreSQL client - pure javascript & libpq with the same API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"database",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"./lib/*.js": "./lib/*.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"pg-connection-string": "^2.
|
|
35
|
+
"pg-connection-string": "^2.11.0",
|
|
36
36
|
"pg-pool": "^3.11.0",
|
|
37
37
|
"pg-protocol": "^1.11.0",
|
|
38
38
|
"pg-types": "2.2.0",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">= 16.0.0"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "fc4de3c62ad350d0e1b392a0d132aff906d1cec6"
|
|
76
76
|
}
|