From 702f8656761c7afbc57dc2a6604bd918b9d02b61 Mon Sep 17 00:00:00 2001 From: Prasanna Date: Thu, 27 Jun 2019 16:31:04 -0700 Subject: [PATCH 1/2] handle null active queries --- lib/client.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/client.js b/lib/client.js index 147637ee7..106e77593 100644 --- a/lib/client.js +++ b/lib/client.js @@ -283,29 +283,39 @@ Client.prototype._attachListeners = function (con) { const self = this // delegate rowDescription to active query con.on('rowDescription', function (msg) { - self.activeQuery.handleRowDescription(msg) + if (self.activeQuery) { + self.activeQuery.handleRowDescription(msg) + } }) // delegate dataRow to active query con.on('dataRow', function (msg) { - self.activeQuery.handleDataRow(msg) + if (self.activeQuery) { + self.activeQuery.handleDataRow(msg) + } }) // delegate portalSuspended to active query // eslint-disable-next-line no-unused-vars con.on('portalSuspended', function (msg) { - self.activeQuery.handlePortalSuspended(con) + if (self.activeQuery) { + self.activeQuery.handlePortalSuspended(con) + } }) // delegate emptyQuery to active query // eslint-disable-next-line no-unused-vars con.on('emptyQuery', function (msg) { - self.activeQuery.handleEmptyQuery(con) + if (self.activeQuery) { + self.activeQuery.handleEmptyQuery(con) + } }) // delegate commandComplete to active query con.on('commandComplete', function (msg) { - self.activeQuery.handleCommandComplete(msg, con) + if (self.activeQuery) { + self.activeQuery.handleCommandComplete(msg, con) + } }) // if a prepared statement has a name and properly parses @@ -313,11 +323,12 @@ Client.prototype._attachListeners = function (con) { // it again on the same client // eslint-disable-next-line no-unused-vars con.on('parseComplete', function (msg) { - if (self.activeQuery.name) { + if (self.activeQuery && self.activeQuery.name) { con.parsedStatements[self.activeQuery.name] = self.activeQuery.text } }) + // eslint-disable-next-line no-unused-vars con.on('copyInResponse', function (msg) { self.activeQuery.handleCopyInResponse(self.connection) From c95056e41ae736160a2519babe186ac014c10fad Mon Sep 17 00:00:00 2001 From: Prasanna Date: Fri, 5 Jul 2019 13:39:13 -0700 Subject: [PATCH 2/2] version bump --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c7b3ce039..e07618fbe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pg", - "version": "7.11.0", + "version": "7.11.1", "description": "PostgreSQL client - pure javascript & libpq with the same API", "keywords": [ "database", @@ -27,6 +27,9 @@ "pgpass": "1.x", "semver": "4.3.2" }, + "publishConfig": { + "registry": "http://admin.branch.io:8081/nexus/content/repositories/npm-internal/" + }, "devDependencies": { "async": "0.9.0", "bluebird": "3.5.2",