Comparing version 7.4.1 to 7.4.2
@@ -69,3 +69,3 @@ All major and minor releases are briefly explained below. | ||
// your friendly neighboorhood pool interface, without the singleton | ||
// your friendly neighborhood pool interface, without the singleton | ||
pool.connect(function(err, client, done) { | ||
@@ -117,3 +117,3 @@ // ... | ||
### v4.4.0 | ||
- Warn to `stderr` if a named query exceeds 63 characters which is the max lenght supported by postgres. | ||
- Warn to `stderr` if a named query exceeds 63 characters which is the max length supported by postgres. | ||
@@ -120,0 +120,0 @@ ### v4.3.0 |
@@ -22,3 +22,3 @@ 'use strict' | ||
config = config || {} | ||
this.stream = config.stream || new net.Stream() | ||
this.stream = config.stream || new net.Socket() | ||
this._keepAlive = config.keepAlive | ||
@@ -86,4 +86,9 @@ this.lastBuffer = false | ||
var responseCode = buffer.toString('utf8') | ||
if (responseCode !== 'S') { | ||
return self.emit('error', new Error('The server does not support SSL connections')) | ||
switch (responseCode) { | ||
case 'N': // Server does not support SSL connections | ||
return self.emit('error', new Error('The server does not support SSL connections')) | ||
case 'S': // Server supports SSL connections, continue with a secure connection | ||
break | ||
default: // Any other response byte, including 'E' (ErrorResponse) indicating a server error | ||
return self.emit('error', new Error('There was an error establishing an SSL connection')) | ||
} | ||
@@ -94,2 +99,3 @@ var tls = require('tls') | ||
servername: host, | ||
checkServerIdentity: self.ssl.checkServerIdentity, | ||
rejectUnauthorized: self.ssl.rejectUnauthorized, | ||
@@ -315,3 +321,5 @@ ca: self.ssl.ca, | ||
this._ending = true | ||
return this.stream.write(END_BUFFER) | ||
return this.stream.write(END_BUFFER, () => { | ||
this.stream.end() | ||
}) | ||
} | ||
@@ -624,3 +632,3 @@ | ||
Connection.prototype.parseInt32 = function (buffer) { | ||
var value = buffer.readInt32BE(this.offset, true) | ||
var value = buffer.readInt32BE(this.offset) | ||
this.offset += 4 | ||
@@ -631,3 +639,3 @@ return value | ||
Connection.prototype.parseInt16 = function (buffer) { | ||
var value = buffer.readInt16BE(this.offset, true) | ||
var value = buffer.readInt16BE(this.offset) | ||
this.offset += 2 | ||
@@ -634,0 +642,0 @@ return value |
@@ -178,3 +178,3 @@ 'use strict' | ||
connection.execute({ | ||
portal: this.portalName, | ||
portal: this.portal, | ||
rows: rows | ||
@@ -205,3 +205,3 @@ }, true) | ||
connection.bind({ | ||
portal: self.portalName, | ||
portal: self.portal, | ||
statement: self.name, | ||
@@ -214,3 +214,3 @@ values: self.values, | ||
type: 'P', | ||
name: self.portalName || '' | ||
name: self.portal || '' | ||
}, true) | ||
@@ -217,0 +217,0 @@ |
@@ -11,3 +11,2 @@ 'use strict' | ||
var types = require('pg-types') | ||
var escape = require('js-string-escape') | ||
@@ -69,6 +68,14 @@ // result object returned from query | ||
// rowData is an array of text or binary values | ||
// this turns the row into a JavaScript object | ||
Result.prototype.parseRow = function (rowData) { | ||
return new this.RowCtor(this._parsers, rowData) | ||
var row = {} | ||
for (var i = 0, len = rowData.length; i < len; i++) { | ||
var rawValue = rowData[i] | ||
var field = this.fields[i].name | ||
if (rawValue !== null) { | ||
row[field] = this._parsers[i](rawValue) | ||
} else { | ||
row[field] = null | ||
} | ||
} | ||
return row | ||
} | ||
@@ -80,15 +87,2 @@ | ||
var inlineParser = function (fieldName, i) { | ||
return "\nthis['" + | ||
// fields containing single quotes will break | ||
// the evaluated javascript unless they are escaped | ||
// see https://github.com/brianc/node-postgres/issues/507 | ||
// Addendum: However, we need to make sure to replace all | ||
// occurences of apostrophes, not just the first one. | ||
// See https://github.com/brianc/node-postgres/issues/934 | ||
escape(fieldName) + | ||
"'] = " + | ||
'rowData[' + i + '] == null ? null : parsers[' + i + '](rowData[' + i + ']);' | ||
} | ||
Result.prototype.addFields = function (fieldDescriptions) { | ||
@@ -103,3 +97,2 @@ // clears field definitions | ||
} | ||
var ctorBody = '' | ||
for (var i = 0; i < fieldDescriptions.length; i++) { | ||
@@ -110,9 +103,3 @@ var desc = fieldDescriptions[i] | ||
this._parsers.push(parser) | ||
// this is some craziness to compile the row result parsing | ||
// results in ~60% speedup on large query result sets | ||
ctorBody += inlineParser(desc.name, i) | ||
} | ||
if (!this.rowAsArray) { | ||
this.RowCtor = Function('parsers', 'rowData', ctorBody) | ||
} | ||
} | ||
@@ -119,0 +106,0 @@ |
{ | ||
"name": "pg", | ||
"version": "7.4.1", | ||
"version": "7.4.2", | ||
"description": "PostgreSQL client - pure javascript & libpq with the same API", | ||
@@ -23,3 +23,2 @@ "keywords": [ | ||
"buffer-writer": "1.0.1", | ||
"js-string-escape": "1.0.1", | ||
"packet-reader": "0.3.1", | ||
@@ -26,0 +25,0 @@ "pg-connection-string": "0.1.3", |
@@ -8,3 +8,3 @@ # node-postgres | ||
Non-blocking PostgreSQL client for node.js. Pure JavaScript and optional native libpq bindings. | ||
Non-blocking PostgreSQL client for Node.js. Pure JavaScript and optional native libpq bindings. | ||
@@ -23,5 +23,5 @@ ## Install | ||
* Pure JavaScript client and native libpq bindings share _the same api_ | ||
* Pure JavaScript client and native libpq bindings share _the same API_ | ||
* Connection pooling | ||
* Extensible js<->postgresql data-type coercion | ||
* Extensible JS<->PostgreSQL data-type coercion | ||
* Supported PostgreSQL features | ||
@@ -40,7 +40,7 @@ * Parameterized queries | ||
node-postgres is free software. If you encounter a bug with the library please open an issue on the [github repo](https://github.com/brianc/node-postgres). If you have questions unanswered by the documentation please open an issue pointing out how the documentation was unclear & I will do my best to make it better! | ||
node-postgres is free software. If you encounter a bug with the library please open an issue on the [GitHub repo](https://github.com/brianc/node-postgres). If you have questions unanswered by the documentation please open an issue pointing out how the documentation was unclear & I will do my best to make it better! | ||
When you open an issue please provide: | ||
- version of node | ||
- version of postgres | ||
- version of Node | ||
- version of Postgres | ||
- smallest possible snippet of code to reproduce the problem | ||
@@ -52,3 +52,3 @@ | ||
I offer professional support for node-postgres. I provide implementation, training, and many years of expertise on how to build applications with node, express, PostgreSQL, and react/redux. Please contact me at [brian.m.carlson@gmail.com](mailto:brian.m.carlson@gmail.com) to discuss how I can help your company be more successful! | ||
I offer professional support for node-postgres. I provide implementation, training, and many years of expertise on how to build applications with Node, Express, PostgreSQL, and React/Redux. Please contact me at [brian.m.carlson@gmail.com](mailto:brian.m.carlson@gmail.com) to discuss how I can help your company be more successful! | ||
@@ -70,3 +70,3 @@ ### Sponsorship :star: | ||
The causes and solutions to common errors can be found among the [Frequently Asked Questions(FAQ)](https://github.com/brianc/node-postgres/wiki/FAQ) | ||
The causes and solutions to common errors can be found among the [Frequently Asked Questions (FAQ)](https://github.com/brianc/node-postgres/wiki/FAQ) | ||
@@ -73,0 +73,0 @@ ## License |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
141881
7
22
3590
3
- Removedjs-string-escape@1.0.1
- Removedjs-string-escape@1.0.1(transitive)