pg 6.0.5 → 6.1.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/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ For richer information consult the commit log on github with referenced pull req
4
4
 
5
5
  We do not include break-fix version release in this file.
6
6
 
7
+ ### v6.1.0
8
+
9
+ - Add optional callback parameter to the pure JavaScript `client.end` method. The native client already supported this.
10
+
7
11
  ### v6.0.0
8
12
 
9
13
  #### Breaking Changes
package/lib/client.js CHANGED
@@ -336,8 +336,11 @@ Client.prototype.query = function(config, values, callback) {
336
336
  return query;
337
337
  };
338
338
 
339
- Client.prototype.end = function() {
339
+ Client.prototype.end = function(cb) {
340
340
  this.connection.end();
341
+ if (cb) {
342
+ this.connection.once('end', cb);
343
+ }
341
344
  };
342
345
 
343
346
  Client.md5 = function(string) {
package/lib/connection.js CHANGED
@@ -122,6 +122,9 @@ Connection.prototype.attachListeners = function(stream) {
122
122
  packet = self._reader.read();
123
123
  }
124
124
  });
125
+ stream.on('end', function() {
126
+ self.emit('end');
127
+ });
125
128
  };
126
129
 
127
130
  Connection.prototype.requestSsl = function() {
package/lib/result.js CHANGED
@@ -7,7 +7,6 @@
7
7
  */
8
8
 
9
9
  var types = require('pg-types');
10
- var escape = require('js-string-escape');
11
10
 
12
11
  //result object returned from query
13
12
  //in the 'end' event and also
@@ -76,13 +75,13 @@ Result.prototype.addRow = function(row) {
76
75
 
77
76
  var inlineParser = function(fieldName, i) {
78
77
  return "\nthis['" +
79
- // fields containing single quotes will break
80
- // the evaluated javascript unless they are escaped
81
- // see https://github.com/brianc/node-postgres/issues/507
82
- // Addendum: However, we need to make sure to replace all
83
- // occurences of apostrophes, not just the first one.
84
- // See https://github.com/brianc/node-postgres/issues/934
85
- escape(fieldName) +
78
+ //fields containing single quotes will break
79
+ //the evaluated javascript unless they are escaped
80
+ //see https://github.com/brianc/node-postgres/issues/507
81
+ //Addendum: However, we need to make sure to replace all
82
+ //occurences of apostrophes, not just the first one.
83
+ //See https://github.com/brianc/node-postgres/issues/934
84
+ fieldName.replace(/'/g, "\\'") +
86
85
  "'] = " +
87
86
  "rowData[" + i + "] == null ? null : parsers[" + i + "](rowData[" + i + "]);";
88
87
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg",
3
- "version": "6.0.5",
3
+ "version": "6.1.0",
4
4
  "description": "PostgreSQL client - pure javascript & libpq with the same API",
5
5
  "keywords": [
6
6
  "postgres",
@@ -19,7 +19,6 @@
19
19
  "main": "./lib",
20
20
  "dependencies": {
21
21
  "buffer-writer": "1.0.1",
22
- "js-string-escape": "1.0.1",
23
22
  "packet-reader": "0.2.0",
24
23
  "pg-connection-string": "0.1.3",
25
24
  "pg-pool": "1.*",