pg 8.16.0 → 8.16.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/README.md +1 -1
- package/lib/result.js +2 -1
- package/lib/utils.js +12 -1
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ You can also follow me [@briancarlson](https://twitter.com/briancarlson) if that
|
|
|
46
46
|
|
|
47
47
|
## Sponsorship :two_hearts:
|
|
48
48
|
|
|
49
|
-
node-postgres's continued development has been made possible in part by generous
|
|
49
|
+
node-postgres's continued development has been made possible in part by generous financial support from [the community](https://github.com/brianc/node-postgres/blob/master/SPONSORS.md).
|
|
50
50
|
|
|
51
51
|
If you or your company are benefiting from node-postgres and would like to help keep the project financially sustainable [please consider supporting](https://github.com/sponsors/brianc) its development.
|
|
52
52
|
|
package/lib/result.js
CHANGED
|
@@ -66,7 +66,8 @@ class Result {
|
|
|
66
66
|
const rawValue = rowData[i]
|
|
67
67
|
const field = this.fields[i].name
|
|
68
68
|
if (rawValue !== null) {
|
|
69
|
-
|
|
69
|
+
const v = this.fields[i].format === 'binary' ? Buffer.from(rawValue) : rawValue
|
|
70
|
+
row[field] = this._parsers[i](v)
|
|
70
71
|
} else {
|
|
71
72
|
row[field] = null
|
|
72
73
|
}
|
package/lib/utils.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const defaults = require('./defaults')
|
|
4
4
|
|
|
5
|
+
const util = require('util')
|
|
6
|
+
const { isDate } = util.types || util // Node 8 doesn't have `util.types`
|
|
7
|
+
|
|
5
8
|
function escapeElement(elementRepresentation) {
|
|
6
9
|
const escaped = elementRepresentation.replace(/\\/g, '\\\\').replace(/"/g, '\\"')
|
|
7
10
|
|
|
@@ -60,7 +63,7 @@ const prepareValue = function (val, seen) {
|
|
|
60
63
|
}
|
|
61
64
|
return buf.slice(val.byteOffset, val.byteOffset + val.byteLength) // Node.js v4 does not support those Buffer.from params
|
|
62
65
|
}
|
|
63
|
-
if (val
|
|
66
|
+
if (isDate(val)) {
|
|
64
67
|
if (defaults.parseInputDatesAsUTC) {
|
|
65
68
|
return dateToStringUTC(val)
|
|
66
69
|
} else {
|
|
@@ -173,6 +176,14 @@ const escapeLiteral = function (str) {
|
|
|
173
176
|
let hasBackslash = false
|
|
174
177
|
let escaped = "'"
|
|
175
178
|
|
|
179
|
+
if (str == null) {
|
|
180
|
+
return "''"
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (typeof str !== 'string') {
|
|
184
|
+
return "''"
|
|
185
|
+
}
|
|
186
|
+
|
|
176
187
|
for (let i = 0; i < str.length; i++) {
|
|
177
188
|
const c = str[i]
|
|
178
189
|
if (c === "'") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg",
|
|
3
|
-
"version": "8.16.
|
|
3
|
+
"version": "8.16.2",
|
|
4
4
|
"description": "PostgreSQL client - pure javascript & libpq with the same API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"database",
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
"require": "./lib/index.js",
|
|
26
26
|
"default": "./lib/index.js"
|
|
27
27
|
},
|
|
28
|
+
"./package.json": {
|
|
29
|
+
"default": "./package.json"
|
|
30
|
+
},
|
|
28
31
|
"./lib/*": {
|
|
29
32
|
"import": "./lib/*",
|
|
30
33
|
"require": "./lib/*",
|
|
@@ -32,9 +35,9 @@
|
|
|
32
35
|
}
|
|
33
36
|
},
|
|
34
37
|
"dependencies": {
|
|
35
|
-
"pg-connection-string": "^2.9.
|
|
36
|
-
"pg-pool": "^3.10.
|
|
37
|
-
"pg-protocol": "^1.10.
|
|
38
|
+
"pg-connection-string": "^2.9.1",
|
|
39
|
+
"pg-pool": "^3.10.1",
|
|
40
|
+
"pg-protocol": "^1.10.2",
|
|
38
41
|
"pg-types": "2.2.0",
|
|
39
42
|
"pgpass": "1.0.5"
|
|
40
43
|
},
|
|
@@ -50,7 +53,7 @@
|
|
|
50
53
|
"wrangler": "^3.x"
|
|
51
54
|
},
|
|
52
55
|
"optionalDependencies": {
|
|
53
|
-
"pg-cloudflare": "^1.2.
|
|
56
|
+
"pg-cloudflare": "^1.2.6"
|
|
54
57
|
},
|
|
55
58
|
"peerDependencies": {
|
|
56
59
|
"pg-native": ">=3.0.1"
|
|
@@ -70,7 +73,7 @@
|
|
|
70
73
|
],
|
|
71
74
|
"license": "MIT",
|
|
72
75
|
"engines": {
|
|
73
|
-
"node": ">=
|
|
76
|
+
"node": ">= 16.0.0"
|
|
74
77
|
},
|
|
75
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "1a25d128177dd7c54dc4652bbb92ac7986306e3f"
|
|
76
79
|
}
|