mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
Fix for pg@7.5 (#47)
* Fix for pg@7.5 Don't return anything from `stream.submit` * Add node@10 to travis version * Relax version of node@4.x
This commit is contained in:
parent
e762b48e48
commit
2446fdb8d0
@ -1,7 +1,8 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "4.2"
|
||||
- "4"
|
||||
- "6"
|
||||
- "8"
|
||||
- "10"
|
||||
env:
|
||||
- PGUSER=postgres PGDATABASE=postgres
|
||||
|
||||
3
index.js
3
index.js
@ -8,7 +8,7 @@ class PgQueryStream extends Readable {
|
||||
this.cursor = new Cursor(text, values)
|
||||
this._reading = false
|
||||
this._closed = false
|
||||
this.batchSize = (options || { }).batchSize || 100
|
||||
this.batchSize = (options || {}).batchSize || 100
|
||||
|
||||
// delegate Submittable callbacks to cursor
|
||||
this.handleRowDescription = this.cursor.handleRowDescription.bind(this.cursor)
|
||||
@ -21,7 +21,6 @@ class PgQueryStream extends Readable {
|
||||
|
||||
submit (connection) {
|
||||
this.cursor.submit(connection)
|
||||
return this
|
||||
}
|
||||
|
||||
close (callback) {
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
"eslint-plugin-promise": "^3.5.0",
|
||||
"eslint-plugin-standard": "^3.0.1",
|
||||
"mocha": "^3.5.0",
|
||||
"pg": "6.x",
|
||||
"pg": "^7.5.0",
|
||||
"stream-spec": "~0.3.5",
|
||||
"stream-tester": "0.0.5",
|
||||
"through": "~2.3.4"
|
||||
|
||||
@ -9,15 +9,18 @@ helper('fast reader', function (client) {
|
||||
var result = []
|
||||
stream.on('readable', function () {
|
||||
var res = stream.read()
|
||||
if (result.length !== 201) {
|
||||
assert(res, 'should not return null on evented reader')
|
||||
} else {
|
||||
// a readable stream will emit a null datum when it finishes being readable
|
||||
// https://nodejs.org/api/stream.html#stream_event_readable
|
||||
assert.equal(res, null)
|
||||
}
|
||||
if (res) {
|
||||
result.push(res.num)
|
||||
while (res) {
|
||||
if (result.length !== 201) {
|
||||
assert(res, 'should not return null on evented reader')
|
||||
} else {
|
||||
// a readable stream will emit a null datum when it finishes being readable
|
||||
// https://nodejs.org/api/stream.html#stream_event_readable
|
||||
assert.equal(res, null)
|
||||
}
|
||||
if (res) {
|
||||
result.push(res.num)
|
||||
}
|
||||
res = stream.read()
|
||||
}
|
||||
})
|
||||
stream.on('end', function () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user