pg 8.11.2 → 8.11.3

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/lib/result.js +10 -3
  2. package/package.json +2 -2
package/lib/result.js CHANGED
@@ -21,6 +21,7 @@ class Result {
21
21
  if (this.rowAsArray) {
22
22
  this.parseRow = this._parseRowAsArray
23
23
  }
24
+ this._prebuiltEmptyResultObject = null
24
25
  }
25
26
 
26
27
  // adds a command complete message
@@ -60,14 +61,12 @@ class Result {
60
61
  }
61
62
 
62
63
  parseRow(rowData) {
63
- var row = {}
64
+ var row = { ... this._prebuiltEmptyResultObject }
64
65
  for (var i = 0, len = rowData.length; i < len; i++) {
65
66
  var rawValue = rowData[i]
66
67
  var field = this.fields[i].name
67
68
  if (rawValue !== null) {
68
69
  row[field] = this._parsers[i](rawValue)
69
- } else {
70
- row[field] = null
71
70
  }
72
71
  }
73
72
  return row
@@ -94,6 +93,14 @@ class Result {
94
93
  this._parsers[i] = types.getTypeParser(desc.dataTypeID, desc.format || 'text')
95
94
  }
96
95
  }
96
+ this._createPrebuiltEmptyResultObject()
97
+ }
98
+ _createPrebuiltEmptyResultObject() {
99
+ var row = {}
100
+ for (var i = 0; i < this.fields.length; i++) {
101
+ row[this.fields[i].name] = null
102
+ }
103
+ this._prebuiltEmptyResultObject = { ... row }
97
104
  }
98
105
  }
99
106
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg",
3
- "version": "8.11.2",
3
+ "version": "8.11.3",
4
4
  "description": "PostgreSQL client - pure javascript & libpq with the same API",
5
5
  "keywords": [
6
6
  "database",
@@ -60,5 +60,5 @@
60
60
  "engines": {
61
61
  "node": ">= 8.0.0"
62
62
  },
63
- "gitHead": "a2a355a6807bf75d92d7f0cb0f219588811a5356"
63
+ "gitHead": "a84ebb3fe85edafb1b358965bdb5e3de58b12c5d"
64
64
  }