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:
Brian C 2018-10-08 12:50:11 -05:00 committed by GitHub
parent e762b48e48
commit 2446fdb8d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 13 deletions

View File

@ -1,7 +1,8 @@
language: node_js
node_js:
- "4.2"
- "4"
- "6"
- "8"
- "10"
env:
- PGUSER=postgres PGDATABASE=postgres

View File

@ -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) {

View File

@ -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"

View File

@ -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 () {