pg 7.0.2 → 7.1.2
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 +6 -0
- package/README.md +4 -0
- package/SPONSORS.md +8 -0
- package/lib/connection-parameters.js +6 -5
- package/lib/index.js +1 -4
- package/lib/result.js +2 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ 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
|
+
### 7.1.0
|
|
8
|
+
|
|
9
|
+
#### Enhancements
|
|
10
|
+
|
|
11
|
+
- [You can now supply both a connection string and additional config options to clients.](https://github.com/brianc/node-postgres/pull/1363)
|
|
12
|
+
|
|
7
13
|
### 7.0.0
|
|
8
14
|
|
|
9
15
|
#### Breaking Changes
|
package/README.md
CHANGED
|
@@ -48,6 +48,10 @@ You can also follow me [@briancarlson](https://twitter.com/briancarlson) if that
|
|
|
48
48
|
|
|
49
49
|
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!
|
|
50
50
|
|
|
51
|
+
### Sponsorship :star:
|
|
52
|
+
|
|
53
|
+
If you are benefiting from node-postgres and would like to help keep the project financially sustainable please visit Brian Carlson's [Patreon page](https://www.patreon.com/node_postgres).
|
|
54
|
+
|
|
51
55
|
## Contributing
|
|
52
56
|
|
|
53
57
|
__:heart: contributions!__
|
package/SPONSORS.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
node-postgres is made possible by the helpful contributors from the community well as the following generous supporters on [Patreon](https://www.patreon.com/node_postgres).
|
|
2
|
+
|
|
3
|
+
# Leaders
|
|
4
|
+
|
|
5
|
+
# Supporters
|
|
6
|
+
- John Fawcett
|
|
7
|
+
- Lalit Kapoor [@lalitkapoor](https://twitter.com/lalitkapoor)
|
|
8
|
+
- Paul Frazee [@pfrazee](https://twitter.com/pfrazee)
|
|
@@ -11,6 +11,8 @@ var dns = require('dns')
|
|
|
11
11
|
|
|
12
12
|
var defaults = require('./defaults')
|
|
13
13
|
|
|
14
|
+
var parse = require('pg-connection-string').parse // parses a connection string
|
|
15
|
+
|
|
14
16
|
var val = function (key, config, envVar) {
|
|
15
17
|
if (envVar === undefined) {
|
|
16
18
|
envVar = process.env[ 'PG' + key.toUpperCase() ]
|
|
@@ -25,9 +27,6 @@ var val = function (key, config, envVar) {
|
|
|
25
27
|
defaults[key]
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
// parses a connection string
|
|
29
|
-
var parse = require('pg-connection-string').parse
|
|
30
|
-
|
|
31
30
|
var useSsl = function () {
|
|
32
31
|
switch (process.env.PGSSLMODE) {
|
|
33
32
|
case 'disable':
|
|
@@ -43,12 +42,14 @@ var useSsl = function () {
|
|
|
43
42
|
|
|
44
43
|
var ConnectionParameters = function (config) {
|
|
45
44
|
// if a string is passed, it is a raw connection string so we parse it into a config
|
|
46
|
-
config = typeof config === 'string' ? parse(config) :
|
|
45
|
+
config = typeof config === 'string' ? parse(config) : config || {}
|
|
46
|
+
|
|
47
47
|
// if the config has a connectionString defined, parse IT into the config we use
|
|
48
48
|
// this will override other default values with what is stored in connectionString
|
|
49
49
|
if (config.connectionString) {
|
|
50
|
-
config = parse(config.connectionString)
|
|
50
|
+
config = Object.assign({}, config, parse(config.connectionString))
|
|
51
51
|
}
|
|
52
|
+
|
|
52
53
|
this.user = val('user', config)
|
|
53
54
|
this.database = val('database', config)
|
|
54
55
|
this.port = parseInt(val('port', config), 10)
|
package/lib/index.js
CHANGED
|
@@ -15,10 +15,7 @@ var Pool = require('pg-pool')
|
|
|
15
15
|
|
|
16
16
|
const poolFactory = (Client) => {
|
|
17
17
|
var BoundPool = function (options) {
|
|
18
|
-
var config = { Client: Client }
|
|
19
|
-
for (var key in options) {
|
|
20
|
-
config[key] = options[key]
|
|
21
|
-
}
|
|
18
|
+
var config = Object.assign({ Client: Client }, options)
|
|
22
19
|
return new Pool(config)
|
|
23
20
|
}
|
|
24
21
|
|
package/lib/result.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
var types = require('pg-types')
|
|
11
|
+
var escape = require('js-string-escape')
|
|
11
12
|
|
|
12
13
|
// result object returned from query
|
|
13
14
|
// in the 'end' event and also
|
|
@@ -82,7 +83,7 @@ var inlineParser = function (fieldName, i) {
|
|
|
82
83
|
// Addendum: However, we need to make sure to replace all
|
|
83
84
|
// occurences of apostrophes, not just the first one.
|
|
84
85
|
// See https://github.com/brianc/node-postgres/issues/934
|
|
85
|
-
fieldName
|
|
86
|
+
escape(fieldName) +
|
|
86
87
|
"'] = " +
|
|
87
88
|
'rowData[' + i + '] == null ? null : parsers[' + i + '](rowData[' + i + ']);'
|
|
88
89
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.2",
|
|
4
4
|
"description": "PostgreSQL client - pure javascript & libpq with the same API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"postgres",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"buffer-writer": "1.0.1",
|
|
22
22
|
"packet-reader": "0.3.1",
|
|
23
|
+
"js-string-escape": "1.0.1",
|
|
23
24
|
"pg-connection-string": "0.1.3",
|
|
24
25
|
"pg-pool": "2.*",
|
|
25
26
|
"pg-types": "1.*",
|